Merge pull request #565 from LedgerHQ/cev/B2CA-1558_Port-Flex
B2CA-1558: Port Ethereum on Flex
@@ -1,7 +1,6 @@
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
ColumnLimit: 100
|
||||
PointerAlignment: Right
|
||||
@@ -12,7 +11,6 @@ SortIncludes: false
|
||||
SpaceAfterCStyleCast: true
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
BinPackArguments: false
|
||||
|
||||
2
.github/workflows/codespell.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Misspelings CI
|
||||
name: Misspellings CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
11
.mdl.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# Style file for mdl
|
||||
# https://github.com/markdownlint/markdownlint/blob/main/docs/creating_styles.md
|
||||
|
||||
# Include all rules
|
||||
all
|
||||
|
||||
# Disable specific rules
|
||||
#exclude_rule 'MD012'
|
||||
|
||||
# Update rules configuration
|
||||
rule 'MD013', :line_length => 120
|
||||
14
.mdlrc
Normal file
@@ -0,0 +1,14 @@
|
||||
# markdownlint config file
|
||||
|
||||
# Use custom style file
|
||||
style "#{File.dirname(__FILE__)}/.mdl.rb"
|
||||
|
||||
# MD002 - First header in file should be a top level header
|
||||
# MD005 - Inconsistent indentation for list items at the same level
|
||||
# MD007 - Unordered list indentation
|
||||
# MD014 - Dollar signs used before commands without showing output
|
||||
# MD024 - Multiple headers with the same content
|
||||
# MD029 - Ordered list item prefix
|
||||
# MD033 - Inline HTML
|
||||
# MD041 - First line in file should be a top level header
|
||||
rules "~MD002,~MD005,~MD007,~MD014,~MD024,~MD029,~MD033,~MD041"
|
||||
47
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,47 @@
|
||||
# To install hooks, run:
|
||||
# pre-commit install --hook-type pre-commit
|
||||
# pre-commit install --hook-type commit-msg
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.6.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- id: mixed-line-ending
|
||||
- id: check-added-large-files
|
||||
- id: check-merge-conflict
|
||||
- id: check-case-conflict
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.2.6
|
||||
hooks:
|
||||
- id: codespell
|
||||
args: ['--ignore-words-list', 'ontop,shft,hte', '--skip', 'makefile_conf/chain/*,tests/ragger/eip712_input_files/*']
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v12.0.1
|
||||
hooks:
|
||||
- id: clang-format
|
||||
types_or: [c]
|
||||
|
||||
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
|
||||
rev: v1.6.27.13
|
||||
hooks:
|
||||
- id: actionlint
|
||||
types_or: [yaml]
|
||||
args: [-shellcheck='' -pyflakes='']
|
||||
|
||||
- repo: https://github.com/markdownlint/markdownlint
|
||||
rev: v0.12.0
|
||||
hooks:
|
||||
- id: markdownlint
|
||||
types_or: [markdown]
|
||||
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: v2.16.2
|
||||
hooks:
|
||||
- id: pylint
|
||||
types: [python]
|
||||
args: ['--jobs=0', '--rcfile=tests/ragger/setup.cfg']
|
||||
files: '^tests/ragger/.*$'
|
||||
@@ -124,7 +124,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
|
||||
- EIP-191 improvements, now lets the user see the entire message one chunk at a time (255 characters for LNX & LNS+, 99 for LNS)
|
||||
- EIP-191 improvements, now lets the user see the entire message one chunk at a time
|
||||
(255 characters for LNX & LNS+, 99 for LNS)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -145,7 +146,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
|
||||
- EIP-191 signatures now show (up to 99 characters on LNS and 255 on LNX & LNS+) the actual data contained in the message (clear-signing)
|
||||
- EIP-191 signatures now show (up to 99 characters on LNS and 255 on LNX & LNS+) the actual data
|
||||
contained in the message (clear-signing)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -256,7 +258,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Added
|
||||
|
||||
- When blind signing is disabled in settings, and a transaction with smart conract interactions is sent to the app, a new warning screen pops to let the user know that the setting must be enabled to sign this kind of transactions.
|
||||
- When blind signing is disabled in settings, and a transaction with smart conract interactions is sent to the app,
|
||||
a new warning screen pops to let the user know that the setting must be enabled to sign this kind of transactions.
|
||||
|
||||
## [1.9.4](https://github.com/ledgerhq/app-ethereum/compare/1.9.3...1.9.4) - 2021-9-14
|
||||
|
||||
|
||||
13
Makefile
@@ -44,7 +44,7 @@ APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev
|
||||
|
||||
# Application source files
|
||||
APP_SOURCE_PATH += src src_features src_plugins
|
||||
ifeq ($(TARGET_NAME),TARGET_STAX)
|
||||
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
|
||||
APP_SOURCE_PATH += src_nbgl
|
||||
else
|
||||
APP_SOURCE_PATH += src_bagl
|
||||
@@ -55,7 +55,7 @@ APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/crypto_helpers.c
|
||||
APP_SOURCE_FILES += ${BOLOS_SDK}/lib_standard_app/format.c
|
||||
INCLUDES_PATH += ${BOLOS_SDK}/lib_standard_app
|
||||
|
||||
ifeq ($(TARGET_NAME),TARGET_STAX)
|
||||
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
|
||||
NETWORK_ICONS_FILE = $(GEN_SRC_DIR)/net_icons.gen.c
|
||||
NETWORK_ICONS_DIR = $(shell dirname "$(NETWORK_ICONS_FILE)")
|
||||
|
||||
@@ -71,12 +71,13 @@ ICON_NANOS = icons/nanos_app_chain_$(CHAIN_ID).gif
|
||||
ICON_NANOX = icons/nanox_app_chain_$(CHAIN_ID).gif
|
||||
ICON_NANOSP = icons/nanox_app_chain_$(CHAIN_ID).gif
|
||||
ICON_STAX = icons/stax_app_chain_$(CHAIN_ID).gif
|
||||
ICON_FLEX = icons/flex_app_chain_$(CHAIN_ID).gif
|
||||
|
||||
#prepare hsm generation
|
||||
ifeq ($(TARGET_NAME),TARGET_STAX)
|
||||
DEFINES += ICONGLYPH=C_stax_chain_$(CHAIN_ID)_64px
|
||||
DEFINES += ICONBITMAP=C_stax_chain_$(CHAIN_ID)_64px_bitmap
|
||||
DEFINES += ICONGLYPH_SMALL=C_stax_chain_$(CHAIN_ID)
|
||||
ifeq ($(TARGET_NAME),$(filter $(TARGET_NAME),TARGET_STAX TARGET_FLEX))
|
||||
DEFINES += ICONGLYPH=C_chain_$(CHAIN_ID)_64px
|
||||
DEFINES += ICONBITMAP=C_chain_$(CHAIN_ID)_64px_bitmap
|
||||
DEFINES += ICONGLYPH_SMALL=C_chain_$(CHAIN_ID)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -263,9 +263,11 @@ to compile and run them.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are what makes the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
|
||||
Contributions are what makes the open source community such an amazing place to learn, inspire, and create.
|
||||
Any contributions you make are **greatly appreciated**.
|
||||
|
||||
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag `enhancement`.
|
||||
If you have a suggestion that would make this better, please fork the repo and create a pull request.
|
||||
You can also simply open an issue with the tag `enhancement`.
|
||||
|
||||
1. Fork the Project
|
||||
2. Create your Feature Branch (`git checkout -b feature/my-feature`)
|
||||
|
||||
@@ -147,6 +147,14 @@ class EthAppClient:
|
||||
return self._exchange_async(self._cmd_builder.get_eth2_public_addr(display,
|
||||
bip32_path))
|
||||
|
||||
def perform_privacy_operation(self,
|
||||
display: bool = True,
|
||||
bip32_path: str = "m/44'/60'/0'/0/0",
|
||||
pubkey: bytes = bytes()):
|
||||
return self._exchange(self._cmd_builder.perform_privacy_operation(display,
|
||||
bip32_path,
|
||||
pubkey))
|
||||
|
||||
def provide_domain_name(self, challenge: int, name: str, addr: bytes) -> RAPDU:
|
||||
payload = format_tlv(DomainNameTag.STRUCTURE_TYPE, 3) # TrustedDomainName
|
||||
payload += format_tlv(DomainNameTag.STRUCTURE_VERSION, 1)
|
||||
|
||||
@@ -17,6 +17,7 @@ class InsType(IntEnum):
|
||||
PROVIDE_ERC20_TOKEN_INFORMATION = 0x0a
|
||||
PROVIDE_NFT_INFORMATION = 0x14
|
||||
SET_PLUGIN = 0x16
|
||||
PERFORM_PRIVACY_OPERATION = 0x18
|
||||
EIP712_SEND_STRUCT_DEF = 0x1a
|
||||
EIP712_SEND_STRUCT_IMPL = 0x1c
|
||||
EIP712_SEND_FILTERING = 0x1e
|
||||
@@ -260,6 +261,16 @@ class CommandBuilder:
|
||||
0x00,
|
||||
payload)
|
||||
|
||||
def perform_privacy_operation(self,
|
||||
display: bool,
|
||||
bip32_path: str,
|
||||
pubkey: bytes) -> bytes:
|
||||
payload = pack_derivation_path(bip32_path)
|
||||
return self._serialize(InsType.PERFORM_PRIVACY_OPERATION,
|
||||
int(display),
|
||||
0x01 if pubkey else 0x00,
|
||||
payload + pubkey)
|
||||
|
||||
def set_plugin(self,
|
||||
type_: int,
|
||||
version: int,
|
||||
|
||||
@@ -332,10 +332,7 @@ def next_timeout(_signum: int, _frame):
|
||||
|
||||
|
||||
def enable_autonext():
|
||||
if app_client._client.firmware.device == 'stax': # Stax Speculos is slow
|
||||
delay = 1.5
|
||||
else:
|
||||
delay = 1/4
|
||||
delay = 1/5
|
||||
signal.setitimer(signal.ITIMER_REAL, delay, delay)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ def get_device_settings(device: str) -> list[SettingID]:
|
||||
SettingID.DEBUG_DATA,
|
||||
SettingID.NONCE
|
||||
]
|
||||
if (device == "nanox") or (device == "nanosp") or (device == "stax"):
|
||||
if device in ("nanox", "nanosp", "stax", "flex"):
|
||||
return [
|
||||
SettingID.BLIND_SIGNING,
|
||||
SettingID.DEBUG_DATA,
|
||||
@@ -30,17 +30,28 @@ def get_device_settings(device: str) -> list[SettingID]:
|
||||
return []
|
||||
|
||||
|
||||
settings_per_page = 3
|
||||
def get_setting_per_page(device: str) -> int:
|
||||
if device == "stax":
|
||||
return 3
|
||||
return 2
|
||||
|
||||
|
||||
def get_setting_position(device: str, setting: Union[NavInsID, SettingID]) -> tuple[int, int]:
|
||||
screen_height = 672 # px
|
||||
header_height = 85 # px
|
||||
footer_height = 124 # px
|
||||
settings_per_page = get_setting_per_page(device)
|
||||
if device == "stax":
|
||||
screen_height = 672 # px
|
||||
header_height = 85 # px
|
||||
footer_height = 132 # px
|
||||
option_offset = 350 # px
|
||||
else:
|
||||
screen_height = 600 # px
|
||||
header_height = 92 # px
|
||||
footer_height = 97 # px
|
||||
option_offset = 420 # px
|
||||
usable_height = screen_height - (header_height + footer_height)
|
||||
setting_height = usable_height // settings_per_page
|
||||
index_in_page = get_device_settings(device).index(SettingID(setting)) % settings_per_page
|
||||
return 350, header_height + (setting_height * index_in_page) + (setting_height // 2)
|
||||
return option_offset, header_height + (setting_height * index_in_page) + (setting_height // 2)
|
||||
|
||||
|
||||
def settings_toggle(fw: Firmware, nav: Navigator, to_toggle: list[SettingID]):
|
||||
@@ -57,7 +68,7 @@ def settings_toggle(fw: Firmware, nav: Navigator, to_toggle: list[SettingID]):
|
||||
moves += [NavInsID.BOTH_CLICK] # Back
|
||||
else:
|
||||
moves += [NavInsID.USE_CASE_HOME_SETTINGS]
|
||||
moves += [NavInsID.USE_CASE_SETTINGS_NEXT]
|
||||
settings_per_page = get_setting_per_page(fw.device)
|
||||
for setting in settings:
|
||||
setting_idx = settings.index(setting)
|
||||
if (setting_idx > 0) and (setting_idx % settings_per_page) == 0:
|
||||
|
||||
|
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 734 B |
|
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 734 B |
|
Before Width: | Height: | Size: 641 B After Width: | Height: | Size: 641 B |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 748 B |
|
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 720 B After Width: | Height: | Size: 720 B |
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 654 B After Width: | Height: | Size: 654 B |
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 543 B |
1
glyphs/chain_11155111_64px.gif
Symbolic link
@@ -0,0 +1 @@
|
||||
chain_1_64px.gif
|
||||
|
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 448 B |
|
Before Width: | Height: | Size: 212 B After Width: | Height: | Size: 212 B |
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 622 B |
|
Before Width: | Height: | Size: 681 B After Width: | Height: | Size: 681 B |
|
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 584 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
1
glyphs/chain_17000_64px.gif
Symbolic link
@@ -0,0 +1 @@
|
||||
chain_1_64px.gif
|
||||
|
Before Width: | Height: | Size: 966 B After Width: | Height: | Size: 966 B |
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 825 B |
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
|
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 649 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 886 B |
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
|
Before Width: | Height: | Size: 914 B After Width: | Height: | Size: 914 B |
|
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 587 B |
|
Before Width: | Height: | Size: 997 B After Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 985 B After Width: | Height: | Size: 985 B |
|
Before Width: | Height: | Size: 836 B After Width: | Height: | Size: 836 B |
|
Before Width: | Height: | Size: 340 B After Width: | Height: | Size: 340 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
|
Before Width: | Height: | Size: 610 B After Width: | Height: | Size: 610 B |
|
Before Width: | Height: | Size: 354 B After Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 293 B |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
|
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 835 B |
|
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 342 B |
|
Before Width: | Height: | Size: 596 B After Width: | Height: | Size: 596 B |
|
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 228 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 910 B After Width: | Height: | Size: 910 B |
|
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 493 B |
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 798 B |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 493 B |
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 780 B After Width: | Height: | Size: 780 B |
|
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 815 B After Width: | Height: | Size: 815 B |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 701 B After Width: | Height: | Size: 701 B |
|
Before Width: | Height: | Size: 885 B After Width: | Height: | Size: 885 B |
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 1019 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 349 B |
|
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 763 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 300 B |