Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add LND containers for testing #77

Merged
merged 51 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ad7f7f1
feat: add LND containers for testing
DhananjayPurohit Jul 19, 2024
885ce44
fix: lightning latch test run on actions
DhananjayPurohit Jul 19, 2024
35ca4ea
fix: install mocha
DhananjayPurohit Jul 19, 2024
cf6cea4
fix: wallet names
DhananjayPurohit Jul 22, 2024
88f504b
feat: add test to get preimage before batch unlock
DhananjayPurohit Jul 22, 2024
8eff04b
feat: add test for sender recover coin after batch timeout
DhananjayPurohit Jul 23, 2024
53792b4
fix: increase test timeout
DhananjayPurohit Jul 23, 2024
3d9ddac
feat: wallet creation on lnd nodes
DhananjayPurohit Jul 26, 2024
408afba
feat: wallet creation on lnd nodes
DhananjayPurohit Jul 26, 2024
6cd0017
fix: merge conflicts
DhananjayPurohit Jul 26, 2024
b577566
fix: merge conflicts
DhananjayPurohit Jul 26, 2024
550a6e5
fix: wallet creation on start of lnd
DhananjayPurohit Jul 29, 2024
4c0f05c
fix: wallet unlock flag
DhananjayPurohit Jul 30, 2024
97abb92
debug: lnd node logs
DhananjayPurohit Jul 30, 2024
48734a6
fix: add sleep for lnd to sync with latest block
DhananjayPurohit Jul 30, 2024
328d63e
fix: upgrade lnd version
DhananjayPurohit Jul 30, 2024
680555b
fix: zmq flags in bitcoind config
DhananjayPurohit Jul 30, 2024
3bbebd2
fix: port for node second to listen
DhananjayPurohit Jul 30, 2024
604c0ac
feat: add script to open channel
DhananjayPurohit Jul 31, 2024
a3a4ee3
feat: add fn to generate invoice
DhananjayPurohit Jul 31, 2024
8767ede
fix: test failure
DhananjayPurohit Aug 1, 2024
6b13af4
feat: add test to steal hold invoice amount
DhananjayPurohit Aug 1, 2024
4ccdfe9
fix: await for hold invoice payment
DhananjayPurohit Aug 2, 2024
996530d
fix: import error
DhananjayPurohit Aug 5, 2024
d10eacc
fix: upgrade docker image version in actions
DhananjayPurohit Aug 5, 2024
10b42e3
fix: install docker compose
DhananjayPurohit Aug 5, 2024
5ee3e9c
fix: container name
DhananjayPurohit Aug 5, 2024
b7d203d
fix: network name
DhananjayPurohit Aug 5, 2024
cd29822
fix: add assertion for invoice payment failure
DhananjayPurohit Aug 5, 2024
6f1f09d
feat: add test for sender sends coin without batch_id
DhananjayPurohit Aug 5, 2024
7f25d5b
feat: add fn for invoice verification against payment hash
DhananjayPurohit Aug 6, 2024
e7497ca
fix: merge conflicts
DhananjayPurohit Aug 6, 2024
eeb5b5f
feat: add test for invoice verification
DhananjayPurohit Aug 6, 2024
f7d2e2a
feat: setup web client tests on actions
DhananjayPurohit Aug 7, 2024
f22c7b7
feat: setup esplora for actions
DhananjayPurohit Aug 8, 2024
bd5f677
feat: add dockerfile for node server
DhananjayPurohit Aug 13, 2024
abd5138
feat: add wallet creation for esplora
DhananjayPurohit Aug 13, 2024
991149b
feat: add test for atomic swap for web client
DhananjayPurohit Aug 14, 2024
3057150
feat: add test for coin steal in atomic swap for web client
DhananjayPurohit Aug 14, 2024
28763e6
feat: add test for lightning latch
DhananjayPurohit Aug 14, 2024
af2d2b2
feat: add test for invoice for lightning latch
DhananjayPurohit Aug 15, 2024
e644c64
Fix/dockerfile token server (#85)
DhananjayPurohit Aug 12, 2024
5b32154
Add payment hash verification to web client
ssantos21 Aug 12, 2024
b02551b
Add log crate to the server
ssantos21 Aug 12, 2024
6e2241a
fix: The pre-image is now only revealed if the transfer is unlocked.
ssantos21 Aug 13, 2024
9e3b931
fix: import error
DhananjayPurohit Aug 15, 2024
c4dbe45
feat: add endpoints for invoice ops on node server
DhananjayPurohit Aug 15, 2024
82ef89e
feat: add test for invoice handling for lightning latch
DhananjayPurohit Aug 15, 2024
d8a31d4
feat: add endpoint for decode invoice
DhananjayPurohit Aug 15, 2024
c96e690
refactor: verify invoice test
DhananjayPurohit Aug 16, 2024
703a583
fix: merge conflicts
DhananjayPurohit Aug 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 79 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

services:
docker:
image: docker:19.03.12
image: docker:24.0.5
options: --privileged
ports:
- 5432:5432
Expand All @@ -32,13 +32,20 @@ jobs:

- name: Set up Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose -f docker-compose-test.yml up --build -d
- name: Run start-test-components.sh for web client tests
run: |
cd clients/tests/web
chmod +x start-test-components.sh
./start-test-components.sh
- name: Wait for services to be ready
run: |
sleep 80 # Adjust time as necessary for services to initialize
- name: Verify Bitcoin daemon Service with Curl
- name: Verify Bitcoin daemon Service and create wallet
run: |
container_id=$(docker ps -qf "name=mercurylayer_bitcoind_1")
container_id=$(docker ps -qf "name=mercurylayer-bitcoind-1")
echo "Container ID: $container_id"
docker logs $container_id
wallet_name="new_wallet"
Expand All @@ -47,19 +54,54 @@ jobs:
echo "New Wallet Address: $address"
docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 101 "$address"
docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress bcrt1pcngfxjdkf4r2h26k52dh5nunxg8m68uf4lkfhmfjvjj6agfkm5jqmftw4e 0.0001
- name: Create wallet for esplora
run: |
container_id=$(docker ps -qf "name=esplora-container")
echo "Container ID: $container_id"
docker logs $container_id
wallet_name="esplora_wallet"
docker exec $container_id cli createwallet $wallet_name
address=$(docker exec $container_id cli getnewaddress $wallet_name)
echo "New Wallet Address: $address"
docker exec $container_id cli generatetoaddress 101 "$address"
docker exec $container_id cli sendtoaddress bcrt1pcngfxjdkf4r2h26k52dh5nunxg8m68uf4lkfhmfjvjj6agfkm5jqmftw4e 0.0001
- name: Wait for services to be ready
run: |
sleep 60 # Wait for lnd to sync with latest block
- name: Verify LND nodes and create a channel between them
run: |
container_id_alice=$(docker ps -qf "name=mercurylayer-alice-1")
echo "Container ID: $container_id_alice"
container_id_bob=$(docker ps -qf "name=mercurylayer-bob-1")
echo "Container ID: $container_id_bob"
docker logs $container_id_alice
docker logs $container_id_bob
identity_pubkey_bob=$(docker exec $container_id_bob lncli -n regtest getinfo | jq -r '.identity_pubkey')
echo "Pubkey: $identity_pubkey_bob"
docker exec $container_id_alice lncli -n regtest connect $identity_pubkey_bob@bob:9735
docker exec $container_id_alice lncli -n regtest listpeers
address=$(docker exec $container_id_bob lncli -n regtest newaddress p2wkh | jq -r '.address')
container_id_bitcoind=$(docker ps -qf "name=mercurylayer-bitcoind-1")
docker exec $container_id_bitcoind bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress $address 0.5
docker exec $(docker ps -qf "name=mercurylayer-bitcoind-1") bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -generate 6
identity_pubkey_alice=$(docker exec $container_id_alice lncli -n regtest getinfo | jq -r '.identity_pubkey')
docker exec $container_id_bob lncli -n regtest openchannel $identity_pubkey_alice 100000
docker exec $(docker ps -qf "name=mercurylayer-bitcoind-1") bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass -generate 5
docker logs $container_id_alice
docker logs $container_id_bob
- name: Verify ElectrumX Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer_electrs_1")
container_id=$(docker ps -qf "name=mercurylayer-electrs-1")
echo "Container ID: $container_id"
docker logs $container_id
- name: Verify Enclave Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer_enclave-sgx_1")
container_id=$(docker ps -qf "name=mercurylayer-enclave-sgx-1")
echo "Container ID: $container_id"
docker logs $container_id
- name: Verify Mercury Service with Curl
run: |
container_id=$(docker ps -qf "name=mercurylayer_mercury_1")
container_id=$(docker ps -qf "name=mercurylayer-mercury-1")
echo "Container ID: $container_id"
docker logs $container_id
docker exec $container_id \
Expand All @@ -71,14 +113,23 @@ jobs:
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'
docker logs $(docker ps -qf "name=enclave")
- name: Verify Node Service with Curl
run: |
curl -X POST http://0.0.0.0:3000/deposit_amount \
-H 'Content-Type: application/json' \
-d '{"address":"bcrt1pkygl356c6fvk6ptx72c64hrjkhcxecj4hjzfzc430svzczuv6m0s42lvwx","amount":1000}'
- name: Verify Esplora Service with Curl
run: |
curl http://0.0.0.0:8094/regtest/api/blocks/tip/height
docker logs $(docker ps -qf "name=esplora-container")
- name: Check connectivity between containers
run: |
# Get container IDs
enclave_container=$(docker ps -qf "name=mercurylayer_enclave-sgx_1")
mercury_container=$(docker ps -qf "name=mercurylayer_mercury_1")
enclave_container=$(docker ps -qf "name=mercurylayer-enclave-sgx-1")
mercury_container=$(docker ps -qf "name=mercurylayer-mercury-1")

# Check if mercurylayer_mercury_1 can reach mercurylayer_enclave-sgx_1
docker exec $mercury_container curl -v http://mercurylayer_enclave-sgx_1:18080/get_public_key \
# Check if mercurylayer-mercury-1 can reach mercurylayer-enclave-sgx-1
docker exec $mercury_container curl -v http://mercurylayer-enclave-sgx-1:18080/get_public_key \
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'

Expand All @@ -88,7 +139,7 @@ jobs:
-H "Content-Type: application/json" \
-d '{"statechain_id":"550e8400e29b41d4a716446655440000"}'

docker inspect mercurylayer_mercury_1
docker inspect mercurylayer-mercury-1
- name: Set up Node.js
uses: actions/setup-node@v2
with:
Expand All @@ -98,15 +149,32 @@ jobs:
run: |
cd clients/apps/nodejs
npm install
npm install mocha -g
- name: Install Node.js dependencies for web client
run: |
cd clients/tests/web
npm install
npx playwright install
npx playwright install-deps
- name: Install Node.js dependencies for lib
run: |
cd clients/libs/nodejs
npm install
- name: Install Node.js dependencies for web
run: |
cd clients/libs/web
npm install
- name: Run web client Tests
run: |
cd clients/tests/web
sudo chmod -R 755 ./data_bitcoin_regtest
npx vitest --browser.name=chromium --browser.headless
- name: Run Client-Side Tests
run: |
cd clients/apps/nodejs
node test_basic_workflow2.js
node test_atomic_swap.js
mocha ./test/tb04-simple-lightning-latch.mjs --exit
- name: Tear Down
run: |
docker-compose -f docker-compose-test.yml down
Loading
Loading