commerceblock / mercurylayer

A Blinded implementation of mercury statechains
51 stars 9 forks source link

Integration testing framework #49

Open tomt1664 opened 3 weeks ago

tomt1664 commented 3 weeks ago

Current integration test workflow: https://github.com/commerceblock/mercurylayer/blob/dev/clients/nodejs/test_basic_workflow.js

Aim: a fully automated system that can set-up and run the series of tests - and can add to CI/github actions. For full reproducibility we need enclave+server and DB, as well as a bitcoin regtest node and electrum server.

Components:

  1. Postgres database:
    
    Pull postgres image:

docker pull postgres Run DB:

docker run --name some-postgres -e POSTGRES_PASSWORD=pgpassword -p 5432:5432 -d postgres



2. Bitcoin regtest node with electrum server

Can use https://bitcoindev.network/getting-started-with-nigiri/

3. Mercury server with enclave connected to the some-postgres DB. 
4. Configure client to connect to electrum server and mercury server, and run test workflow. 

[ttps://github.com/ory/dockertest](https://github.com/ory/dockertest)
tomt1664 commented 3 weeks ago

For the enclave, configure DB connection string for a postgres database in: https://github.com/commerceblock/mercurylayer/tree/dev/enclave

Set enclave_port to expose on one instance.

Set replication_server_url to a second instance.

Run 2 instances in sim mode using docker: https://github.com/commerceblock/mercurylayer/blob/dev/enclave/Dockerfiles/SIM/Dockerfile

This will automatically initialse both instances. This first (with enclave_port set) can be configured with lockbox = "http://0.0.0.0:18080" in the mercury server config.

The server should be run with network="testnet" config.

Then to go though sample mercury operations (e.g deposit, transfer), follow this guide with one of the standalone clients: https://github.com/commerceblock/mercurylayer/blob/testnet_guide/docs/testnet_guide.md

(do not set tor proxy, just set statechain_entity = "http://127.0.0.1:8000" location).

When server is in testnet mode, can generate token IDs for deposit using deposit/get_token