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
6 changes: 3 additions & 3 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ jobs:

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

job_test_testnet:
Expand Down Expand Up @@ -166,8 +166,8 @@ jobs:

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

job_test_python_lib_legacyapp:
Expand All @@ -193,8 +193,8 @@ jobs:

- name: Run tests
run: |
pip install --prefer-binary -r requirements.txt
cd bitcoin_client/tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --timeout=300 --model=nanosp

job_test_js_lib:
Expand Down
174 changes: 81 additions & 93 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,9 @@ ifeq ($(BOLOS_SDK),)
$(error Environment variable BOLOS_SDK is not set)
endif

include $(BOLOS_SDK)/Makefile.defines

# TODO: Compile with the right path restrictions
#
# The right path restriction would be something like
# --path "*'/0'"
# for mainnet, and
# --path "*'/1'"
# for testnet.
#
# That is, restrict the BIP-44 coin_type, but not the purpose.
# However, such wildcards are not currently supported by the OS.
#
# Note that the app still requires explicit user approval before exporting
# any xpub outside of a small set of allowed standard paths.

# Application allowed derivation curves.
CURVE_APP_LOAD_PARAMS = secp256k1

# Application allowed derivation paths.
#
# If there would be a dedicated SDK function returning master key
# fingerprint without the need to derive the root pubkey, the proper path
# configuration should be:
#
# PATH_APP_LOAD_PARAMS = "44'/1'" "48'/1'" "49'/1'" "84'/1'" "86'/1'"
#
PATH_APP_LOAD_PARAMS = ""

# Allowed SLIP21 paths
PATH_SLIP21_APP_LOAD_PARAMS = "LEDGER-Wallet policy"

Expand Down Expand Up @@ -83,94 +57,108 @@ VARIANT_VALUES = bitcoin_testnet bitcoin liquid_regtest liquid_testnet liquid
########################################
# Application custom permissions #
########################################
HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
ifneq (,$(findstring bitcoin,$(COIN)))
HAVE_APPLICATION_FLAG_LIBRARY = 1
endif


ifeq ($(COIN),bitcoin_testnet)
# Application allowed derivation paths (testnet).
PATH_APP_LOAD_PARAMS = "*/1'"

# Bitcoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=196
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
DEFINES += COIN_COINID_SHORT=\"TEST\"
# Bitcoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=196
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
DEFINES += COIN_COINID_SHORT=\"TEST\"

APPNAME = "Bitcoin Test"
DISPLAYED_APPNAME = "Bitcoin Testnet"
APPNAME = "Bitcoin Test"
DISPLAYED_APPNAME = "Bitcoin Testnet"

else ifeq ($(COIN),bitcoin)
# Application allowed derivation paths (mainnet).
PATH_APP_LOAD_PARAMS = "*/0'"

# the version for performance tests automatically approves all requests
# there is no reason to ever compile the mainnet app with this flag
ifneq ($(AUTOAPPROVE_FOR_PERF_TESTS),0)
$(error Use testnet app for performance tests)
endif

# Bitcoin mainnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP44_COIN_TYPE=0
DEFINES += COIN_P2PKH_VERSION=0
DEFINES += COIN_P2SH_VERSION=5
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
DEFINES += COIN_COINID_SHORT=\"BTC\"
# Bitcoin mainnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP44_COIN_TYPE=0
DEFINES += COIN_P2PKH_VERSION=0
DEFINES += COIN_P2SH_VERSION=5
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"bc\"
DEFINES += COIN_COINID_SHORT=\"BTC\"

APPNAME = "Bitcoin"
APPNAME = "Bitcoin"

else ifeq ($(COIN),liquid_regtest)

# Liquid regtest
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP32_PRIVKEY_VERSION=0x04358394
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=75
DEFINES += COIN_PREFIX_CONFIDENTIAL=4
DEFINES += HAVE_LIQUID
DEFINES += LIQUID_NET_REGTEST
DEFINES += COIN_COINID_SHORT=\"tLBTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"ert\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"el\"

APPNAME = "Liquid Regtest"
# Application allowed derivation paths (Liquid testnet/regtest).
PATH_APP_LOAD_PARAMS = "*/1'" # purpose=* / coin_type=Testnet(1)

# Liquid regtest
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP32_PRIVKEY_VERSION=0x04358394
DEFINES += BIP44_COIN_TYPE=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=75
DEFINES += COIN_PREFIX_CONFIDENTIAL=4
DEFINES += HAVE_LIQUID
DEFINES += LIQUID_NET_REGTEST
DEFINES += COIN_COINID_SHORT=\"tLBTC\"
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=\"tLBTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"tlq\"

APPNAME = "Liquid Testnet"
# Application allowed derivation paths (Liquid testnet/regtest).
PATH_APP_LOAD_PARAMS = "*/1'" # purpose=* / coin_type=Testnet(1)

# 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=\"tLBTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"tlq\"

APPNAME = "Liquid Testnet"

else ifeq ($(COIN),liquid)

# Liquid
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP32_PRIVKEY_VERSION=0x0488ADE4
DEFINES += BIP44_COIN_TYPE=1776
DEFINES += COIN_P2PKH_VERSION=57
DEFINES += COIN_P2SH_VERSION=39
DEFINES += COIN_PREFIX_CONFIDENTIAL=12
DEFINES += HAVE_LIQUID
DEFINES += LIQUID_NET_MAINNET
DEFINES += COIN_COINID_SHORT=\"LBTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"ex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"lq\"

APPNAME = "Liquid"
# Application allowed derivation paths (Liquid main network, liquidv1).
PATH_APP_LOAD_PARAMS = "*/1776'" # purpose=* / coin_type=Liquid(1776)

# Liquid
DEFINES += BIP32_PUBKEY_VERSION=0x0488B21E
DEFINES += BIP32_PRIVKEY_VERSION=0x0488ADE4
DEFINES += BIP44_COIN_TYPE=1776
DEFINES += COIN_P2PKH_VERSION=57
DEFINES += COIN_P2SH_VERSION=39
DEFINES += COIN_PREFIX_CONFIDENTIAL=12
DEFINES += HAVE_LIQUID
DEFINES += LIQUID_NET_MAINNET
DEFINES += COIN_COINID_SHORT=\"LBTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"ex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"lq\"

APPNAME = "Liquid"

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

ifneq (,$(findstring liquid,$(COIN)))
Expand Down
2 changes: 1 addition & 1 deletion ledger_app.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[app]
build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+"]
devices = ["nanox", "nanos+"]

[tests]
unit_directory = "./unit-tests/"
Expand Down
14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# requirements for the various test suites

pytest>=6.1.1,<7.0.0
pytest-benchmark>=4.0.0,<5.0.0
pytest-timeout>=2.1.0,<3.0.0
ledgercomm>=1.1.0,<1.2.0
ecdsa>=0.16.1,<0.17.0
typing-extensions>=3.7,<4.0
embit>=0.7.0,<0.8.0
mnemonic==0.20
bip32>=3.4,<4.0
speculos>=0.21.2
ragger[speculos, ledgerwallet]>=1.37.0
-e ./bitcoin_client # path relative to the current working directory; assume it's the root of the repo
Loading
Loading