Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Integration testing with contracts #6

Open
vaibhavchellani opened this issue May 26, 2020 · 3 comments
Open

Integration testing with contracts #6

vaibhavchellani opened this issue May 26, 2020 · 3 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@vaibhavchellani
Copy link
Collaborator

We need to have integration testing with the contracts to be able to mock the contracts on the node and not needing to deploy the contracts for testing features on the node.

@vaibhavchellani vaibhavchellani added the help wanted Extra attention is needed label May 26, 2020
@vaibhavchellani vaibhavchellani self-assigned this May 26, 2020
@vaibhavchellani
Copy link
Collaborator Author

vaibhavchellani commented May 26, 2020

There are currently 2 techniques to do this:

  1. Common test input output maps: We can have a common input/output maps which dictate what the state root should be preProcessing and postProcessing, they also define what the testing data will be exactly. This is great because now we don't need to interact with contracts at all and can test individual components of the system from truffle tests and from go-node. The only con is that it requires a considerable effort to implement. Ideally it would be something like: https://github.com/ethereum/eth2.0-specs/tree/dev/tests

  2. Having fixtures as truffle test, which preset the contracts to whatever state you want them to be by running tests. So a deposit fixture will deploy new contracts, update addresses on the go-node, and make a deposit on the contract, while the node can now do whatever it does when it receives a new deposit. The fixture can then query the DB to check if the state on the node matches the state on the contracts. This allows us to do proper integration testing with actual contracts with the cons being it would be a bit slow as we would be sending actual transactions.

@wanseob
Copy link

wanseob commented May 28, 2020

https://github.com/wanseob/zkopru/blob/master/containers/Contract.dockerfile

I hope this docker file can help you.

https://github.com/wanseob/zkopru/blob/master/packages/integration-test/tests/helper/context.ts

I am using the docker file to prepare the initial context. With the container, I can skip the migration steps or other settings.

@vaibhavchellani
Copy link
Collaborator Author

Thanks a lot @wanseob

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants