Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
222d442
Display confidential addresses for outputs
miketlk Mar 25, 2025
b793074
Add fallback strlcpy to unit tests
miketlk Apr 2, 2025
b12e4aa
Fix unit tests CMake script
miketlk Apr 2, 2025
ec67f3d
Remove temporary branch from CI
miketlk Apr 2, 2025
aeb1a15
Add testnet support
miketlk Apr 4, 2025
b1d9aa8
Temporarily disable guidelines checks for PRs
miketlk Apr 10, 2025
711d588
Update snapshots
miketlk Apr 10, 2025
0a02121
Merge pull request #2 from miketlk/tmp_display_confidential_address
miketlk Apr 10, 2025
2609ec0
Fix build settings issues for Liquid testnet and regtest
miketlk Apr 12, 2025
4fbd28c
Add tests for Liquid testnet
miketlk Apr 12, 2025
c87f1a5
Add testnet tests to GitHub action
miketlk Apr 12, 2025
32d837d
Disable clang-format on mock os.h
miketlk Apr 12, 2025
29661c9
Fix missing Liquid regtest selection for unit tests
miketlk Apr 12, 2025
58d8ee7
Move testnet tests to CI workflow
miketlk Apr 12, 2025
0263fc9
Merge pull request #3 from miketlk/tmp_testnet_support
miketlk Apr 12, 2025
3d5ed4e
Add testned tL-BTC asset
miketlk Apr 14, 2025
5edcd0a
Change testnet and regtest asset names to 'tl-BTC'
miketlk Apr 14, 2025
f25d484
Update snapshots
miketlk Apr 15, 2025
531e97a
Format code
miketlk Apr 15, 2025
3e45b12
Fix wrong asset order in sorted list
miketlk Apr 15, 2025
adeb152
Merge pull request #5 from miketlk/fix_unknown_testned_bitcoin_asset
miketlk Apr 15, 2025
7eb3f4b
Add GitHub Issue and PR templates
miketlk Apr 15, 2025
44d5700
Merge branch 'liquid_release' into liquid_develop
miketlk Apr 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: 🐛 Bug Report
about: Report a problem or unexpected behavior
title: "🐛 [BUG] "
labels: bug
assignees: ''
---

### What happened?

### Steps to reproduce

### Expected behavior

### Screenshots or logs

### Environment
- Wallet Device:
- App Version:
- Host Platform:

### Additional context
24 changes: 24 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/build_ci_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 📦 Build or CI/CD Issue
about: Report a problem with build system, CI/CD pipeline, or deployment
title: "📦 [CI/BUILD] "
labels: ci, build
assignees: ''
---

### Describe the issue
What broke? What did you expect instead?

### Affected platform(s)
- [ ] Local build
- [ ] GitHub Actions
- [ ] Docker
- [ ] Other (specify below)

### Logs or errors
Paste relevant logs or error output here.

### Steps to reproduce (if applicable)

### Additional context
Any recent changes that may be related?
17 changes: 17 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: 📝 Documentation Issue
about: Report a problem or improvement suggestion related to the documentation
title: "📝 [DOCS] "
labels: documentation
assignees: ''
---

### What is missing, unclear, or incorrect?

### Location in docs
Link to file or section (or describe it).

### Suggested fix or improvement

### Additional context
Screenshots, examples, or other relevant info.
15 changes: 15 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: 🌟 Feature Request
about: Suggest a new idea or improvement
title: "🌟 [FEATURE] "
labels: enhancement
assignees: ''
---

### What is your idea?

### Why is it useful or important?

### Optional: Suggested solution or example

### Additional context
23 changes: 23 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/integration_compatibility.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: 🧩 Integration / Compatibility Issue
about: Report problems or requests related to external systems, platforms, or libraries
title: "🧩 [INTEGRATION] "
labels: compatibility
assignees: ''
---

### Describe the issue
What isn't working or what needs to be integrated?

### Environment
- Platform or dependency:
- Version(s):
- Operating System / Hardware:

### Expected vs Actual behavior

### Reproduction or reference example
(Optional) Minimal reproducible example or link.

### Additional context
Any related issues or compatibility requirements?
15 changes: 15 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: ❓ Question
about: Ask a general or technical question
title: "❓ [QUESTION] "
labels: question
assignees: ''
---

### Your question

Please describe your question clearly.

### What have you tried?

Any previous research or context?
19 changes: 19 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/test_coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: 🧪 Test Coverage Request
about: Report missing or insufficient test coverage
title: "🧪 [TEST] "
labels: tests
assignees: ''
---

### Area lacking tests
Describe the module/function/class that needs coverage.

### Why this is important
Explain the impact or risk of not having these tests.

### Suggested test approach
(Optional) Brief idea on how to test it.

### Additional context
Any existing issues, crashes, or concerns related to this area.
24 changes: 24 additions & 0 deletions .github/workflows/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Summary

Briefly explain the purpose of this PR.

## Related Issues

- Closes #
- Related to #

## Changes

- Bullet point of key change 1
- Bullet point of key change 2

## Testing

Explain how this was tested or how to test it.

## Checklist

- [ ] Code builds without errors
- [ ] Tests added or updated
- [ ] Documentation updated (if needed)
- [ ] Code reviewed for security and edge cases
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 @@ -34,4 +34,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 @@ -43,6 +43,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 @@ -55,6 +57,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 @@ -135,6 +143,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
4 changes: 2 additions & 2 deletions .github/workflows/guidelines-enforcer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ on:
- develop
# Temporarily disabled until PR #285 is merged to `github.com/LedgerHQ/ledger-app-database`
# - liquid_develop
# - liquid_release
pull_request:
# Temporarily disabled until PR #285 is merged to `github.com/LedgerHQ/ledger-app-database`
# pull_request:

jobs:
guidelines_enforcer:
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
28 changes: 22 additions & 6 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 = liquid_regtest liquid
VARIANT_VALUES = liquid_regtest liquid_testnet liquid

########################################
# Application custom permissions #
Expand All @@ -97,14 +97,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 += COIN_COINID_SHORT=\"L-BTC\"
DEFINES += LIQUID_NET_REGTEST
DEFINES += COIN_COINID_SHORT=\"tL-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=\"tL-BTC\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tex\"
DEFINES += COIN_NATIVE_SEGWIT_PREFIX_CONFIDENTIAL=\"tlq\"

APPNAME = "Liquid Testnet"

else ifeq ($(COIN),liquid)

# Liquid
Expand All @@ -115,7 +131,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 @@ -124,7 +140,7 @@ APPNAME = "Liquid"

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

Expand Down
62 changes: 7 additions & 55 deletions src/handler/get_wallet_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,57 +48,6 @@
#include "liquid.h"
#endif

#ifdef HAVE_LIQUID
/// State of the callback function obtaining `scriptPubKey` of the processed descriptor.
typedef struct {
/// Dispatcher context.
dispatcher_context_t *dc;
/// Pointer to the root node of the policy
const policy_node_t *policy;
/// Pointer to wallet header structure.
const policy_map_wallet_header_t *wallet_header;
} get_script_callback_state_t;

/**
* Callback function obtaining `scriptPubKey` of the processed descriptor.
*
* @param[in,out] state
* Callback state, stores necessary properties of the processed descriptor.
* @param[in] descriptor_idx
* Descriptor index in the in the multipath scheme.
* @param[in] bip44_address_index
* Address index element of the derivation path, defined according to BIP 44.
* @param[out] out_buffer
* Buffer receiving `scriptPubKey`.
*
* @return true if successful, false if error.
*/
static bool get_script_callback(void *state_in,
uint32_t descriptor_idx,
uint32_t bip44_address_index,
buffer_t *out_buffer) {
if (!state_in || descriptor_idx > 1 || !out_buffer ||
buffer_remaining(out_buffer) < MAX_SCRIPT_LEN) {
return false;
}

get_script_callback_state_t *state = (get_script_callback_state_t *) state_in;

int script_len = get_wallet_script(
state->dc,
state->policy,
&(wallet_derivation_info_t){.wallet_version = state->wallet_header->version,
.keys_merkle_root = state->wallet_header->keys_info_merkle_root,
.n_keys = state->wallet_header->n_keys,
.change = !!descriptor_idx,
.address_index = bip44_address_index},
buffer_get_cur(out_buffer));

return script_len > 0 && buffer_seek_cur(out_buffer, script_len);
}

#endif

void handler_get_wallet_address(dispatcher_context_t *dc, uint8_t protocol_version) {
(void) protocol_version;

Expand Down Expand Up @@ -272,13 +221,16 @@ void handler_get_wallet_address(dispatcher_context_t *dc, uint8_t protocol_versi
if (liquid_policy_is_blinded(&wallet_policy_map.parsed)) {
// Derive blinding public key from script
uint8_t blinding_pubkey[33];
get_script_callback_state_t callback_state = {.dc = dc,
.policy = &wallet_policy_map.parsed,
.wallet_header = &wallet_header};
get_wallet_script_callback_state_t callback_state = {
.dc = dc,
.policy = &wallet_policy_map.parsed,
.wallet_version = wallet_header.version,
.keys_merkle_root = wallet_header.keys_info_merkle_root,
.n_keys = wallet_header.n_keys};
if (!liquid_get_blinding_public_key(&wallet_policy_map.parsed,
script,
script_len,
get_script_callback,
get_wallet_script_callback,
&callback_state,
blinding_pubkey)) {
explicit_bzero(blinding_pubkey, sizeof(blinding_pubkey));
Expand Down
Loading
Loading