Skip to content

Commit

Permalink
Merge pull request #172 from LedgerHQ/develop
Browse files Browse the repository at this point in the history
Release 3.3.4
  • Loading branch information
fbeutin-ledger authored Feb 21, 2024
2 parents 902de5c + 6ca675f commit 4f2253b
Show file tree
Hide file tree
Showing 624 changed files with 53 additions and 16 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ APP_LOAD_PARAMS += $(COMMON_LOAD_PARAMS)
APPNAME = "Exchange"
APPVERSION_M = 3
APPVERSION_N = 3
APPVERSION_P = 3
APPVERSION_P = 4
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)

ifdef TESTING
Expand Down Expand Up @@ -70,7 +70,10 @@ DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) LEDGER_MINOR_VERSION=$(APPVERS
DEFINES += OS_IO_SEPROXYHAL
DEFINES += HAVE_SPRINTF
DEFINES += HAVE_IO_USB HAVE_L4_USBLIB IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 HAVE_USB_APDU
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
ifeq ($(TARGET_NAME),TARGET_STAX)
# This is only needed to fix an issue on Stax, and can be removed after version 1.4.0-rc1
DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL=""
endif

DEFINES += USB_SEGMENT_SIZE=64
DEFINES += BLE_SEGMENT_SIZE=32 #max MTU, min 20
Expand Down
40 changes: 32 additions & 8 deletions test/python/apps/ethereum.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,40 @@
from ragger.utils import create_currency_config
from typing import Optional
import struct
from ragger.bip import pack_derivation_path


def get_sub_config(ticker: str, decimals: int, chain_id: Optional[int] = None) -> bytes:
cfg = bytearray()
cfg.append(len(ticker))
cfg += ticker.encode()
cfg.append(decimals)
if chain_id is not None:
cfg += struct.pack(">Q", chain_id)
return cfg


def create_currency_config(main_ticker: str,
application_name: str,
sub_config: bytes = bytes()) -> bytes:
cfg = bytearray()
for elem in [main_ticker.encode(), application_name.encode(), sub_config]:
cfg.append(len(elem))
cfg += elem
return cfg


ETH_PATH = "m/44'/60'/0'/0/0"
ETC_PATH = "m/44'/61'/0'/0/0"

ETH_CONF = create_currency_config("ETH", "Ethereum", ("ETH", 18))
ETH_PACKED_DERIVATION_PATH = pack_derivation_path(ETH_PATH)

ETH_CONF = create_currency_config("ETH", "Ethereum", get_sub_config("ETH", 18))
ETH_PACKED_DERIVATION_PATH = pack_derivation_path(ETH_PATH)

BSC_CONF = create_currency_config("BNB", "Binance Smart Chain", ("BNB", 18))
# Use dedicated app (clone)
BSC_CONF_LEGACY = create_currency_config("BNB", "Binance Smart Chain", get_sub_config("BNB", 18))
# Use Ethereum app
BSC_CONF = create_currency_config("BNB", "Ethereum", get_sub_config("BNB", 18, 56))
BSC_PACKED_DERIVATION_PATH = pack_derivation_path(ETH_PATH)

ETC_PATH = "m/44'/60'/0'/0/0"

ETC_CONF = create_currency_config("ETC", "Ethereum Classic", ("ETC", 18))
ETC_PACKED_DERIVATION_PATH = pack_derivation_path("m/44'/61'/0'/0/0")
ETC_CONF = create_currency_config("ETC", "Ethereum Classic", get_sub_config("ETC", 18))
ETC_PACKED_DERIVATION_PATH = pack_derivation_path(ETC_PATH)
8 changes: 4 additions & 4 deletions test/python/apps/polkadot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from scalecodec.utils.ss58 import ss58_decode

class Method(IntEnum):
BALANCE_TRANSFER = 0x0500
BALANCE_TRANSFER_ALLOW_DEATH = 0x0500
BALANCE_FORCE_TRANSFER = 0x0502

class AccountIdLookupType(IntEnum):
Expand All @@ -35,8 +35,8 @@ def _format_amount(amount: int) -> bytes:
# Not sure what this exactly is but we don't actually care
UNKNOWN = bytes([0x85, 0x02, 0x00, 0x00])

SPEC_VERSION = 9360
TX_VERSION = 24
SPEC_VERSION = 1001000
TX_VERSION = 25

# We don't care about the block hash content
BLOCK_HASH = bytes([0x00] * 32)
Expand Down Expand Up @@ -123,7 +123,7 @@ def verify_signature(self,hex_key:bytes,signature:bytes,message:bytes) -> bool :
return True

def craft_valid_polkadot_transaction(address, send_amount, fees, memo) -> bytes:
return Method.BALANCE_TRANSFER.to_bytes(2, "big") \
return Method.BALANCE_TRANSFER_ALLOW_DEATH.to_bytes(2, "big") \
+ AccountIdLookupType.ID.to_bytes(1, "big") \
+ _polkadot_address_to_pk(address) \
+ _format_amount(send_amount) \
Expand Down
2 changes: 2 additions & 0 deletions test/python/apps/stellar.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def _craft_simple_tx(self, network: Network, fees: int, memo: str, destination:
tx += StrKey.decode_ed25519_public_key(destination)
tx += int.to_bytes(AssetType.ASSET_TYPE_NATIVE, length=4, byteorder='big')
tx += int.to_bytes(send_amount, length=8, byteorder='big')
tx += int.to_bytes(0, length=4, byteorder="big") # tx.ext.v = 0
tx += int.to_bytes(0, length=4, byteorder="big") # sig.len = 0
return tx

def send_simple_sign_tx(self, path: str, network: Network, fees: int, memo: str, destination: str, send_amount: int) -> RAPDU:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/python/snapshots/nanosp/test_bitcoin_fund_valid_1/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/python/snapshots/nanosp/test_bitcoin_fund_valid_2/00003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_1/00003.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_1/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_2/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_2/00003.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_valid_2/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_wrong_fees/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_wrong_fees/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_wrong_fees/00003.png
Binary file modified test/python/snapshots/nanosp/test_bsc_fund_wrong_fees/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_1/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_2/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_valid_2/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_wrong_fees/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_wrong_fees/00002.png
Binary file modified test/python/snapshots/nanosp/test_bsc_sell_wrong_fees/00006.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_valid_1/00005.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_valid_2/00005.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_wrong_fees/00001.png
Binary file modified test/python/snapshots/nanosp/test_bsc_swap_wrong_fees/00005.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_1/00003.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_1/00005.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_2/00003.png
Binary file modified test/python/snapshots/nanosp/test_ripple_swap_valid_2/00005.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_1/00003.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_1/00006.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_2/00002.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_2/00003.png
Binary file modified test/python/snapshots/nanosp/test_solana_fund_valid_2/00006.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_1/00006.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_2/00002.png
Binary file modified test/python/snapshots/nanosp/test_solana_sell_valid_2/00006.png
Binary file modified test/python/snapshots/nanosp/test_solana_swap_valid_1/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_swap_valid_1/00005.png
Binary file modified test/python/snapshots/nanosp/test_solana_swap_valid_2/00001.png
Binary file modified test/python/snapshots/nanosp/test_solana_swap_valid_2/00005.png
Binary file modified test/python/snapshots/nanosp/test_stellar_fund_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_stellar_fund_valid_1/00003.png
Binary file modified test/python/snapshots/nanosp/test_stellar_fund_valid_2/00003.png
Binary file modified test/python/snapshots/nanosp/test_stellar_sell_valid_1/00002.png
Binary file modified test/python/snapshots/nanosp/test_stellar_swap_valid_1/00001.png
Loading

0 comments on commit 4f2253b

Please sign in to comment.