Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ jobs:
with:
download_app_binaries_artifact: "compiled_app_binaries"
test_dir: "tests_liquid"

41 changes: 41 additions & 0 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
make DEBUG=0 COIN=liquid BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-bin/
make clean
make DEBUG=0 COIN=liquid_regtest BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-regtest-bin/
make clean
make DEBUG=0 COIN=liquid_testnet BOLOS_SDK=${{ matrix.SDK }} && mv bin/ liquid-testnet-bin/
- name: Upload Liquid app binary
uses: actions/upload-artifact@v4
with:
Expand All @@ -53,6 +55,12 @@ jobs:
name: liquid-regtest-app-${{ matrix.model }}
path: liquid-regtest-bin

- name: Upload Liquid Testnet app binary
uses: actions/upload-artifact@v4
with:
name: liquid-testnet-app-${{ matrix.model }}
path: liquid-testnet-bin

job_unit_test:
name: Unit test
needs: job_build
Expand Down Expand Up @@ -133,6 +141,39 @@ jobs:
pip install --prefer-binary -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --tb=short -v --device=${{matrix.model}} --speculos_api_port 5000

job_test_testnet:
name: Tests on testnet
strategy:
matrix:
include:
- model: nanos
- model: nanox
- model: nanosp

needs: job_build
runs-on: ubuntu-latest

steps:
- name: Clone
uses: actions/checkout@v4

- name: Download Liquid app binary
uses: actions/download-artifact@v4
with:
name: liquid-testnet-app-${{matrix.model}}
path: build/${{ matrix.model == 'nanosp' && 'nanos2' || matrix.model }}/bin

- name: Install tests dependencies
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static tesseract-ocr libtesseract-dev
pip install -U pip setuptools

- name: Run tests
run: |
cd tests_liquid_testnet
pip install --prefer-binary -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --tb=short -v --device=${{matrix.model}} --speculos_api_port 5000

job_test_python_lib_legacyapp:
if: false
name: Tests with the Python library and legacy Bitcoin app
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tests/.test_bitcoin
tests/snapshots-tmp
tests_liquid/snapshots-tmp
tests_liquid_main/snapshots-tmp
tests_liquid_testnet/snapshots-tmp

# Fuzzing
fuzzing/build/
Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ endif

# Setting to allow building variant applications
VARIANT_PARAM = COIN
VARIANT_VALUES = bitcoin_testnet bitcoin liquid_regtest liquid
VARIANT_VALUES = bitcoin_testnet bitcoin liquid_regtest liquid_testnet liquid

########################################
# Application custom permissions #
Expand Down Expand Up @@ -126,14 +126,30 @@ DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=75
DEFINES += COIN_PREFIX_CONFIDENTIAL=4
DEFINES += HAVE_LIQUID
DEFINES += HAVE_LIQUID_TEST
DEFINES += COIN_BLINDED_VERSION=4
DEFINES += LIQUID_NET_REGTEST
DEFINES += COIN_COINID_SHORT=\"L-BTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"ert\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"el\"

APPNAME = "Liquid Regtest"

else ifeq ($(COIN),liquid_testnet)

# Liquid testnet
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP32_PRIVKEY_VERSION=0x04358394
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=36
DEFINES += COIN_P2SH_VERSION=19
DEFINES += COIN_PREFIX_CONFIDENTIAL=23
DEFINES += HAVE_LIQUID
DEFINES += LIQUID_NET_TESTNET
DEFINES += COIN_COINID_SHORT=\"L-BTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"tlq\"

APPNAME = "Liquid Testnet"

else ifeq ($(COIN),liquid)

# Liquid
Expand All @@ -144,7 +160,7 @@ DEFINES += COIN_P2PKH_VERSION=57
DEFINES += COIN_P2SH_VERSION=39
DEFINES += COIN_PREFIX_CONFIDENTIAL=12
DEFINES += HAVE_LIQUID
DEFINES += COIN_BLINDED_VERSION=12
DEFINES += LIQUID_NET_MAINNET
DEFINES += COIN_COINID_SHORT=\"L-BTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"ex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"lq\"
Expand All @@ -153,7 +169,7 @@ APPNAME = "Liquid"

else
ifeq ($(filter clean,$(MAKECMDGOALS)),)
$(error Unsupported COIN - use bitcoin_testnet, bitcoin, liquid_regtest, liquid)
$(error Unsupported COIN - use bitcoin_testnet, bitcoin, liquid_regtest, liquid_testnet, liquid)
endif
endif

Expand Down
13 changes: 10 additions & 3 deletions src/liquid/liquid_assets.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,23 @@ STATIC_NO_TEST const asset_definition_t liquid_assets[] = {

/// Asset tag of L-BTC or TL-BTC depending on build
const uint8_t liquid_bitcoin_tag[LIQUID_ASSET_TAG_LEN] = {
#ifdef HAVE_LIQUID_TEST
/// Asset tag of TL-BTC
#if defined(LIQUID_NET_REGTEST)
/// Asset tag of regtest TL-BTC
0x5a, 0xc9, 0xf6, 0x5c, 0x0e, 0xfc, 0xc4, 0x77, 0x5e, 0x0b, 0xae,
0xc4, 0xec, 0x03, 0xab, 0xdd, 0xe2, 0x24, 0x73, 0xcd, 0x3c, 0xf3,
0x3c, 0x04, 0x19, 0xca, 0x29, 0x0e, 0x07, 0x51, 0xb2, 0x25
#else
#elif defined(LIQUID_NET_TESTNET)
/// Asset tag of testnet TL-BTC
0x14, 0x4c, 0x65, 0x43, 0x44, 0xaa, 0x71, 0x6d, 0x6f, 0x3a, 0xbc,
0xc1, 0xca, 0x90, 0xe5, 0x64, 0x1e, 0x4e, 0x2a, 0x7f, 0x63, 0x3b,
0xc0, 0x9f, 0xe3, 0xba, 0xf6, 0x45, 0x85, 0x81, 0x9a, 0x49
#elif defined(LIQUID_NET_MAINNET)
/// Asset tag of L-BTC
0x6f, 0x02, 0x79, 0xe9, 0xed, 0x04, 0x1c, 0x3d, 0x71, 0x0a, 0x9f,
0x57, 0xd0, 0xc0, 0x29, 0x28, 0x41, 0x64, 0x60, 0xc4, 0xb7, 0x22,
0xae, 0x34, 0x57, 0xa1, 0x1e, 0xec, 0x38, 0x1c, 0x52, 0x6d
#else
#error Valid net must be selected for Liquid
#endif
};

Expand Down
42 changes: 42 additions & 0 deletions tests_liquid_testnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# End-to-end tests

These tests are implemented in Python and can be executed either using the [Speculos](https://github.com/LedgerHQ/speculos) emulator or a Ledger Nano S/X/SP.

All the commands in this folder are meant to be ran from the `tests` folder, not from the root.

Python dependencies are listed in [requirements.txt](requirements.txt), install them using [pip](https://pypi.org/project/pip/)

```
pip install -r requirements.txt
```

## Launch with Speculos

Build the app as normal for Liquid testnet network from the root folder. For convenience, you probably want to enable DEBUG:

```
COIN=liquid_testnet DEBUG=1 make
```

Then run all the tests from this folder, specifying the device: nanos, nanox, nanosp, or all:

```
pytest --device yourdevice
```
You can enable the screen display with the option `--display`

## Launch with your Nano S/X/SP

Compile and install the app on your device as normal.

To run the tests on your Ledger device you also need to install an optional dependency

```
pip install ledgercomm[hid]
```

Be sure to have you device connected through USB (without any other software interacting with it) and run

```
pytest --device yourdevice --backend ledgercomm
```
Empty file.
Loading
Loading