Closed pik694 closed 5 years ago
Our first thought was to use truffle
as a pretty mature framework, capable of compiling and deploying contracts - we do not need anything more.
The first result of testing truffle
was that we would not be able to deploy contracts using truffle
as this would require us to have an external EVM (ex. ganache
), but we would prefer to stick to the internal EVM. Even though if we tried external EVM, our testing framework would be a Frankenstein - running some python code to run truffle
to run js to compile and link contracts with solcjs
to send them to ganache
.
Therefore we have to abandon thoughts of using truffle to deploy contracts; but we can still use truffle to compile contracts, don't we? We do, but we would have to find some tool to link the deployed libraries to the contracts - we would have to use/write a solc
wrapper - this means we are no closer to the solution as we are seeking something that will replace our current solc
wrapper.
During the research I found a new framework - brownie
, which was written to mimic truffle
. It looks promising, but we would probably like to use more stable solutions. Nevertheless, it is worth keeping a note for the future.
We have been experimenting with web3py
and usage of EthereumTesterProvider
. This provider uses py-evm underneath, which is a reference EVM implementation in python.
In order to link and deploy contracts we used pytest-ethereum, which provides a convenient linker
and deployer
. One minor drawback of using it is that it injects its own fixtures ex. web3. We had to disable those and create our own web3 instance, as we have had to change the default configuration of the EVM (block_limit
).
pytest-ethereum
requires us to provide a package or a manifest at least.
We used py-ethpm to create a manifest from compilation results.
The stack above is fully working and changes required in plasma-contracts
would not be huge, as the tests are isolated from the backend via our testlang - the majority of changes would only touch this module, leaving the tests as they are.
The stack above does not solve one problem - compilation of Solidity 0.5
.
In order to overcome this we would use py-solc-x
.
The stack listed above is promised to be future-proof, but is still in alpha
; and we are afraid of possible problems. As it is all under active development, the interfaces change - all the elements of the stack may not always be compliant. ex. newest web3py
currently does not support the newest py-evm
.
As we are rewriting the RootChain
contract and changing it into so-called plasma framework
, we will gradually rewrite the existing tests into js
and truffle
.
Current stack
Our tests run under
pytest
testing framework. Each run of the tests we run an internalEVM
provided bypyethereum
. We compile and link our contracts usingpy-solc
which wrapssolc
.Motivation for changes
Our main motivation is the fact that
py-solc
does not work withsolidity v0.5
. One other is thatpyethereum
is deprecated.Goal
We would like to have a testing framework that is capable of running
solidity v0.5
. The framework should also be future-proof (at least should look promising).ref #103