Skip to content

Commit

Permalink
Merge pull request #2 from osiastedian/ledger-merged-develop
Browse files Browse the repository at this point in the history
Ledger merged develop
  • Loading branch information
osiastedian authored Sep 26, 2023
2 parents 3591fc9 + f3f3714 commit 10220f4
Show file tree
Hide file tree
Showing 145 changed files with 9,714 additions and 2,743 deletions.
2 changes: 1 addition & 1 deletion .doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Bitcoin"
PROJECT_NAME = "Syscoin"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ ENV PATH=/syscoin-${SYSCOIN_VERSION}/bin:$PATH

EXPOSE 8369 8370 18369 18370 18443 18444 38332 38333

RUN syscoind -version | grep "Syscoin Core version v${SYSCOIN_VERSION}"
# RUN syscoind -version | grep "Syscoin Core version v${SYSCOIN_VERSION}"
13 changes: 9 additions & 4 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ on:
branches:
- master
- develop
- ledger-merged-develop
pull_request:
branches:
- master
- develop

jobs:
job_build:
name: Compilation for NanoS, X and S+
name: Compilation for NanoS, X, S+, and Stax

strategy:
matrix:
Expand All @@ -24,6 +25,8 @@ jobs:
SDK: "$NANOX_SDK"
- model: nanosp
SDK: "$NANOSP_SDK"
- model: stax
SDK: "$STAX_SDK"

runs-on: ubuntu-latest

Expand Down Expand Up @@ -106,6 +109,7 @@ jobs:
- model: nanos
- model: nanox
- model: nanosp
- model: stax

needs: job_build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -135,7 +139,7 @@ jobs:
run: |
cd tests
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }}
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=500
job_test_mainnet:
name: Tests on mainnet
Expand All @@ -145,6 +149,7 @@ jobs:
- model: nanos
- model: nanox
- model: nanosp
- model: stax

needs: job_build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -174,7 +179,7 @@ jobs:
run: |
cd tests_mainnet
pip install -r requirements.txt
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }}
PYTHONPATH=$PYTHONPATH:/speculos pytest --headless --model=${{ matrix.model }} --timeout=300
# Legacy not applicable to Syscoin because no prior app
# job_test_python_lib_legacyapp:
Expand Down Expand Up @@ -259,4 +264,4 @@ jobs:
- name: Run tests
run: |
cd bitcoin_client_rs/
cargo test
cargo test --no-default-features --features="async"
22 changes: 22 additions & 0 deletions .github/workflows/guidelines-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Ensure compliance with Ledger guidelines

# This workflow is mandatory in all applications
# It calls a reusable workflow guidelines_enforcer developed by Ledger's internal developer team.
# The successful completion of the reusable workflow is a mandatory step for an app to be available on the Ledger
# application store.
#
# More information on the guidelines can be found in the repository:
# LedgerHQ/ledger-app-workflows/

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:

jobs:
guidelines_enforcer:
name: Call Ledger guidelines_enforcer
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_guidelines_enforcer.yml@v1
16 changes: 16 additions & 0 deletions .github/workflows/swap-ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Swap functional tests

on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:

jobs:
job_functional_tests:
uses: LedgerHQ/app-exchange/.github/workflows/reusable_swap_functional_tests.yml@develop
with:
branch_for_bitcoin: ${{ github.ref }}
test_filter: '"btc or bitcoin or Bitcoin"'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bin/
debug/
dep/
obj/
build/

# Unit tests and code coverage
unit-tests/build/
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Dates are in `dd-mm-yyyy` format.

## [2.1.3] - 21-06-2023

### Changed

- Improved UX for self-transfers, that is, transactions where all the outputs are change outputs.
- Outputs containing a single `OP_RETURN` (without any data push) can now be signed in order to support [BIP-0322](https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki) implementations.


### Fixed

- Wrong address generation for miniscript policies containing an unusual `thresh(1,X)` fragment (that is, with threshold 1, and a single condition). This should not happen in practice, as the policy is redundant for just `X`. Client libraries have been updated to detect and prevent usage of these policies.
- Resolved a slight regression in signing performance introduced in v2.1.2.

## [2.1.2] - 03-04-2023

### Added

- 🥕 Initial support for taproot scripts; taproot trees support up to 8 leaves, and the only supported scripts in tapleaves are `pk`, `multi_a` and `sortedmulti_a`.

### Fixed

- Miniscript policies containing an `a:` fragment returned an incorrect address in versions `2.1.0` and `2.1.1` of the app. The **upgrade is strongly recommended** for users of miniscript wallets.
- The app will now reject showing or returning an address for a wallet policy if the `address_index` is larger than or equal to `2147483648`; previous version would return an address for a hardened derivation, which is undesirable.
- Nested segwit transactions (P2SH-P2WPKH and P2SH-P2WSH) can now be signed (with a warning) if the PSBT contains the witness-utxo but no non-witness-utxo. This aligns their behavior to other types of Segwitv0 transactions since version 2.0.6.

## [2.1.1] - 23-01-2023

### Changed
Expand Down
158 changes: 53 additions & 105 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,44 @@ endif
include $(BOLOS_SDK)/Makefile.defines

# TODO: compile with the right path restrictions
# APP_LOAD_PARAMS = --curve secp256k1
APP_LOAD_PARAMS = $(COMMON_LOAD_PARAMS)
APP_PATH = ""

APPVERSION_M = 1
# Application allowed derivation curves.
CURVE_APP_LOAD_PARAMS = secp256k1

# Application allowed derivation paths.
PATH_APP_LOAD_PARAMS = ""
APP_LOAD_PARAMS += --path_slip21 "LEDGER-Wallet policy"

# Application version
APPVERSION_M = 2
APPVERSION_N = 0
APPVERSION_P = 0
APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)"


APP_STACK_SIZE = 3072

# Setting to allow building variant applications
VARIANT_PARAM = COIN
VARIANT_VALUES = syscoin_regtest syscoin

# simplify for tests
ifndef COIN
COIN=syscoin_regtest
endif

# Flags: BOLOS_SETTINGS, GLOBAL_PIN, DERIVE_MASTER
APP_LOAD_FLAGS=--appFlags 0xa50
########################################
# Application custom permissions #
########################################
HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1
HAVE_APPLICATION_FLAG_GLOBAL_PIN = 1
HAVE_APPLICATION_FLAG_BOLOS_SETTINGS = 1
HAVE_APPLICATION_FLAG_LIBRARY = 1

ifeq ($(COIN),syscoin_regtest)

# Syscoin testnet, no legacy support
DEFINES += BIP32_PUBKEY_VERSION=0x043587CF
DEFINES += BIP44_COIN_TYPE=1
DEFINES += BIP44_COIN_TYPE_2=1
DEFINES += COIN_P2PKH_VERSION=111
DEFINES += COIN_P2SH_VERSION=196
DEFINES += COIN_NATIVE_SEGWIT_PREFIX=\"tb\"
Expand All @@ -74,32 +86,34 @@ $(error Unsupported COIN - use syscoin_regtest, syscoin)
endif
endif

APP_LOAD_PARAMS += $(APP_LOAD_FLAGS)

ifeq ($(TARGET_NAME),TARGET_NANOS)
ICONNAME=icons/nanos_app_$(COIN).gif
else
ICONNAME=icons/nanox_app_$(COIN).gif
endif

all: default

# TODO: double check if all those flags are still relevant/needed (was copied from legacy app-syscoin)

DEFINES += APPNAME=\"$(APPNAME)\"
DEFINES += APPVERSION=\"$(APPVERSION)\"
DEFINES += MAJOR_VERSION=$(APPVERSION_M) MINOR_VERSION=$(APPVERSION_N) PATCH_VERSION=$(APPVERSION_P)
DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_BAGL HAVE_SPRINTF HAVE_SNPRINTF_FORMAT_U
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) LEDGER_MINOR_VERSION=$(APPVERSION_N) LEDGER_PATCH_VERSION=$(APPVERSION_P) TCS_LOADER_PATCH_VERSION=0
DEFINES += HAVE_UX_FLOW

DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
# Application icons following guidelines:
# https://developers.ledger.com/docs/embedded-app/design-requirements/#device-icon
ICON_NANOS = icons/nanos_app_syscoin.gif
ICON_NANOX = icons/nanox_app_syscoin.gif
ICON_NANOSP = icons/nanox_app_syscoin.gif
ICON_STAX = icons/stax_app_syscoin.gif

########################################
# Application communication interfaces #
########################################
ENABLE_BLUETOOTH = 1

########################################
# NBGL custom features #
########################################
ENABLE_NBGL_QRCODE = 1

########################################
# Features disablers #
########################################
# Don't use standard app file to avoid conflicts for now
DISABLE_STANDARD_APP_FILES = 1

# Don't use default IO_SEPROXY_BUFFER_SIZE to use another
# value for NANOS for an unknown reason.
DISABLE_DEFAULT_IO_SEPROXY_BUFFER_SIZE = 1

DEFINES += UNUSED\(x\)=\(void\)x
DEFINES += APPVERSION=\"$(APPVERSION)\"

DEFINES += HAVE_BOLOS_APP_STACK_CANARY


Expand All @@ -108,16 +122,6 @@ DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=72
DEFINES += HAVE_WALLET_ID_SDK
else
DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300
DEFINES += HAVE_BAGL BAGL_WIDTH=128 BAGL_HEIGHT=64
DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX
DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX
endif

ifeq ($(TARGET_NAME),TARGET_NANOX)
DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000
DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE
endif

ifeq ($(TARGET_NAME),TARGET_NANOS)
Expand All @@ -130,77 +134,21 @@ CFLAGS += -include debug-helpers/debug.h

# DEFINES += HAVE_PRINT_STACK_POINTER

ifndef DEBUG
DEBUG = 0
endif

ifeq ($(DEBUG),0)
DEFINES += PRINTF\(...\)=
else
ifeq ($(DEBUG),10)
$(warning Using semihosted PRINTF. Only run with speculos!)
DEFINES += HAVE_PRINTF HAVE_SEMIHOSTED_PRINTF PRINTF=semihosted_printf
else
ifeq ($(TARGET_NAME),TARGET_NANOS)
DEFINES += HAVE_PRINTF PRINTF=screen_printf
else
DEFINES += HAVE_PRINTF PRINTF=mcu_usb_printf
endif
endif
ifeq ($(DEBUG),10)
$(warning Using semihosted PRINTF. Only run with speculos!)
DEFINES += HAVE_PRINTF HAVE_SEMIHOSTED_PRINTF PRINTF=semihosted_printf
endif


# Needed to be able to include the definition of G_cx
INCLUDES_PATH += $(BOLOS_SDK)/lib_cxng/src


ifneq ($(BOLOS_ENV),)
$(info BOLOS_ENV=$(BOLOS_ENV))
CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/
GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/
else
$(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH)
endif
ifeq ($(CLANGPATH),)
$(info CLANGPATH is not set: clang will be used from PATH)
endif
ifeq ($(GCCPATH),)
$(info GCCPATH is not set: arm-none-eabi-* will be used from PATH)
endif

CC := $(CLANGPATH)clang
CFLAGS += -Oz
AS := $(GCCPATH)arm-none-eabi-gcc
LD := $(GCCPATH)arm-none-eabi-gcc
LDFLAGS += -O3 -Os
LDLIBS += -lm -lgcc -lc

include $(BOLOS_SDK)/Makefile.glyphs

# Application source files
APP_SOURCE_PATH += src
SDK_SOURCE_PATH += lib_stusb lib_stusb_impl lib_ux

ifeq ($(TARGET_NAME),TARGET_NANOX)
SDK_SOURCE_PATH += lib_blewbxx lib_blewbxx_impl
endif

load: all
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS)

load-offline: all
python3 -m ledgerblue.loadApp $(APP_LOAD_PARAMS) --offline

delete:
python3 -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS)

include $(BOLOS_SDK)/Makefile.rules

dep/%.d: %.c Makefile


listvariants:
@echo VARIANTS COIN syscoin_regtest syscoin
# Allow usage of function from lib_standard_app/crypto_helpers.c
APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/crypto_helpers.c

include $(BOLOS_SDK)/Makefile.standard_app

# Makes a detailed report of code and data size in debug/size-report.txt
# More useful for production builds with DEBUG=0
Expand Down
12 changes: 12 additions & 0 deletions bitcoin_client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Dates are in `dd-mm-yyyy` format.

## [0.2.1] - 18-04-2023

### Changed
- Avoid using miniscript policies containing an `a:` fragment on versions below `2.1.2` of the bitcoin app.

## [0.2.0] - 3-04-2023

This release introduces a breaking change in the return type of the `sign_psbt`method.

### Added
- Added new `PartialSignature` data class together with support for taproot script signing, which is supported in version `2.1.2` of the bitcoin app.

## [0.1.2] - 09-01-2023

### Fixed
Expand Down
Loading

0 comments on commit 10220f4

Please sign in to comment.