diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index a141a2d..2bbff60 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -19,8 +19,8 @@ Describe your issue in as much detail as possible here.
## Steps to reproduce
-* Tell us how to reproduce this issue
-* Where the issue is, if you know
+* Tell us how to reproduce this issue
+* Where the issue is, if you know
* Which commands triggered the issue, if any
## Expected behaviour
@@ -37,4 +37,5 @@ Please paste any logs here that demonstrate the issue, if they exist
## Proposed solution
-If you have an idea of how to fix this issue, please write it down here, so we can begin discussing it
\ No newline at end of file
+If you have an idea of how to fix this issue, please write it down here,
+so we can begin discussing it
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index 031ba33..af1481d 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -1,6 +1,6 @@
---
name: Feature report
-about: Suggest an idea for this project
+about: Suggest an idea for this project
title: 'Add [Subject of the issue]'
labels: 'enhancement'
assignees: ''
diff --git a/.github/ISSUE_TEMPLATE/network_request.md b/.github/ISSUE_TEMPLATE/network_request.md
index 369f21e..ee5115a 100644
--- a/.github/ISSUE_TEMPLATE/network_request.md
+++ b/.github/ISSUE_TEMPLATE/network_request.md
@@ -1,6 +1,6 @@
---
name: Network request
-about: Request of new chain or network
+about: Request of new chain or network
title: 'Add {NameChain} network ({SYMBOL})'
labels: 'enhancement, chain/network'
assignees: ''
@@ -8,12 +8,13 @@ assignees: ''
---
## Description
-- [ ] Symbol:
-- [ ] ChainId:
-- [ ] Website:
-- [ ] Block-Explorer:
-- [ ] [slip-0044](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) type:
+
+- [ ] Symbol:
+- [ ] ChainId:
+- [ ] Website:
+- [ ] Block-Explorer:
+- [ ] [slip-0044](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) type:
## Additional comments
-Please post additional comments in this section if you have them, otherwise delete it.
\ No newline at end of file
+Please post additional comments in this section if you have them, otherwise delete it.
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 4024641..b17d695 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -1,6 +1,6 @@
## Description
-Please provide a detailed description of what was done in this PR.
+Please provide a detailed description of what was done in this PR.
(And mentioned if linked to an issue [docs](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue))
## Changes include
@@ -18,4 +18,4 @@ Please complete this section if any breaking changes have been made, otherwise d
## Additional comments
-Please post additional comments in this section if you have them, otherwise delete it.
\ No newline at end of file
+Please post additional comments in this section if you have them, otherwise delete it.
diff --git a/.gitignore b/.gitignore
index 0f19b97..6b3139a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,6 @@
# Compilation of Ledger's app
-src/glyphs.c
-src/glyphs.h
bin/
debug/
-dep/
-obj/
build/
# Python
@@ -20,4 +16,4 @@ tests/elfs/*
tests/snapshots-tmp
.vscode
-.idea
\ No newline at end of file
+.idea
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb41e35..8b9ce8a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -211,7 +211,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
-- Provide network ticker to plugins (especialy helpful for Paraswap plugin)
+- Provide network ticker to plugins (especially helpful for Paraswap plugin)
- Polygon variant
## [1.9.10](https://github.com/ledgerhq/app-ethereum/compare/1.9.9...1.9.10) - 2021-10-08
diff --git a/Makefile b/Makefile
index 0e9fc69..a7a2ef2 100644
--- a/Makefile
+++ b/Makefile
@@ -38,9 +38,9 @@ APPVERSION_P = 1
APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev
APP_LOAD_FLAGS = --appFlags 0xa40 --dep Ethereum:$(APPVERSION)
-###########################
-# Set Chain environnement #
-###########################
+#########################
+# Set Chain environment #
+#########################
ifeq ($(CHAIN),)
CHAIN = ethereum
diff --git a/README.md b/README.md
index 637e3d3..7a71b1a 100644
--- a/README.md
+++ b/README.md
@@ -31,18 +31,17 @@
- [Running all tests](#running-all-tests)
- [With Makefile](#with-makefile)
- [With yarn](#with-yarn)
- - [Running a specific tests](#running-a-specific-tests)
+ - [Running a specific test](#running-a-specific-test)
- [Adding tests](#adding-tests)
- [Zemu](#zemu)
- [Update binaries](#update-binaries)
- [Contributing](#contributing)
-
## About the project
-Ethereum wallet application framework for Nano S, Nano S Plus and Nano X.
+Ethereum wallet application framework for Nano S, Nano S Plus and Nano X.
Ledger Blue is not maintained anymore, but the app can still be compiled for this target using the branch [`blue-final-release`](https://github.com/LedgerHQ/app-ethereum/tree/blue-final-release).
## Documentation
@@ -53,8 +52,9 @@ To compile it and load it on a device, please check out our [developer portal](h
### Plugins
-We have the concept of plugins in the ETH app.
-Find the documentations here:
+We have the concept of plugins in the ETH app.
+Find the documentations here:
+
- [Blog Ethereum plugins](https://blog.ledger.com/ethereum-plugins/)
- [Ethereum application Plugins : Technical Specifications](https://github.com/LedgerHQ/app-ethereum/blob/master/doc/ethapp_plugins.asc)
- [Plugin guide](https://hackmd.io/300Ukv5gSbCbVcp3cZuwRQ)
@@ -68,48 +68,55 @@ Testing is done via the open-source framework [zemu](https://github.com/Zondax/z
- [nodeJS == 16](https://github.com/nvm-sh/nvm)
- [yarn](https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable)
-- [build environnement](https://github.com/LedgerHQ/ledger-app-builder/blob/master/Dockerfile)
+- [build environment](https://github.com/LedgerHQ/ledger-app-builder/blob/master/Dockerfile)
-#### Build the applications required by the test suite
+#### Build the applications required by the test suite
1. Add your BOLOS SDKs path to:
- - `NANOS_SDK` and `NANOX_SDK`
+
+ `NANOS_SDK` and `NANOX_SDK`
2. Go to the `tests` folder and run `./build_local_test_elfs.sh`
- - ```sh
- cd tests
- # This helper script will build the applications required by the test suite and move them at the right place.
- yarn install
- ./build_local_test_elfs.sh
- ```
+
+ ```sh
+ cd tests
+ # This helper script will build the applications required by the test suite and move them at the right place.
+ yarn install
+ ./build_local_test_elfs.sh
+ ```
### Running all tests
+
#### With Makefile
1. Then you can install and run tests by simply running on the `root` of the repo:
- - ```sh
- make test
- ```
- - This will run `make install_tests` and `make run_tests`
+
+ ```sh
+ make test
+ # This will run `make install_tests` and `make run_tests`
+ ```
#### With yarn
1. Go to the `tests` folder and run:
- - ```sh
- yarn test
- ```
-### Running a specific tests
+ ```sh
+ yarn test
+ ```
-1. Go to the `tests` folder and run:
- - ```sh
- yarn jest --runInBand --detectOpenHandles {YourTestFile}
- ```
-2. For example with the `send test`:
- - ```sh
- yarn jest --runInBand --detectOpenHandles src/send.test.js
- ```
+### Running a specific test
+1. Go to the `tests` folder and run:
+
+ ```sh
+ yarn jest --runInBand --detectOpenHandles {YourTestFile}
+ ```
+
+2. For example with the `send test`:
+
+ ```sh
+ yarn jest --runInBand --detectOpenHandles src/send.test.js
+ ```
### Adding tests
@@ -128,7 +135,7 @@ Finally make sure you adapt the expected signature!
#### Update binaries
-Don't forget to update the binaries in the test folder. To do so, compile with those environement variables:
+Don't forget to update the binaries in the test folder. To do so, compile with those environment variables:
```sh
make DEBUG=1 ALLOW_DATA=1
@@ -142,10 +149,9 @@ cp bin/app.elf tests/elfs/ethereum_nanos.elf
Repeat the operation for a binary compiled with nanoX SDK and change for `ethereum_nanox.elf`.
-
## Contributing
-Contributions are what make 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`.
diff --git a/client/pyproject.toml b/client/pyproject.toml
index 3a91961..e68d1a3 100644
--- a/client/pyproject.toml
+++ b/client/pyproject.toml
@@ -48,4 +48,4 @@ Home = "https://github.com/LedgerHQ/app-ethereum"
ignore_missing_imports = true
[tool.flake8]
-max-line-length = 120
\ No newline at end of file
+max-line-length = 120
diff --git a/doc/eth_contract_support_embedded.adoc b/doc/eth_contract_support_embedded.adoc
index 36a582c..629f994 100644
--- a/doc/eth_contract_support_embedded.adoc
+++ b/doc/eth_contract_support_embedded.adoc
@@ -12,7 +12,7 @@ This document described how a specific device UI for a smart contract can be add
## Standard support
-The applications already includes dedicated UI support for those specific contract calls :
+The application already includes dedicated UI support for those specific contract calls :
* ERC 20 approve(address, uint256) - implementation in *src_features/erc20_approval*
* ERC 20 transfer(address, uint256) - implementation in *src_features/signTx*
@@ -45,4 +45,3 @@ A UI implementation might want to convert an ERC 20 token contract address to a
2 tickers can be temporarily provisioned to the application by using the PROVIDE ERC 20 TOKEN INFORMATION APDU, described in *src_features/provideErc20TokenInformation* - the UI can then iterate on the provisioned tickers to display relevant information to the user
The same mechanism will be extended to support well known contract addresses in the future
-
diff --git a/doc/ethapp.adoc b/doc/ethapp.adoc
index 6fba964..10637a0 100644
--- a/doc/ethapp.adoc
+++ b/doc/ethapp.adoc
@@ -801,7 +801,7 @@ None
This command provides a trusted way of deciding what information from the JSON data to show and replace some values by more meaningful ones.
-This mode can be overriden by the in-app setting to fully clear-sign EIP-712 messages.
+This mode can be overridden by the in-app setting to fully clear-sign EIP-712 messages.
For the signatures :
diff --git a/examples/signMessageEIP711v0.py b/examples/signMessageEIP711v0.py
index 97b8ef1..cbe6595 100755
--- a/examples/signMessageEIP711v0.py
+++ b/examples/signMessageEIP711v0.py
@@ -59,7 +59,7 @@ if args.path == None:
domainHash = binascii.unhexlify(args.domainHash)
messageHash = binascii.unhexlify(args.messageHash)
-encodedTx = domainHash + messageHash
+encodedTx = domainHash + messageHash
donglePath = parse_bip32_path(args.path)
apdu = bytearray.fromhex("e00c0000")
diff --git a/makefile_conf/chain/akroma.mk b/makefile_conf/chain/akroma.mk
index 68c935f..0426bdb 100644
--- a/makefile_conf/chain/akroma.mk
+++ b/makefile_conf/chain/akroma.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/200625'"
TICKER = "AKA"
CHAIN_ID = 200625
-APPNAME = "Akroma"
\ No newline at end of file
+APPNAME = "Akroma"
diff --git a/makefile_conf/chain/artis_sigma1.mk b/makefile_conf/chain/artis_sigma1.mk
index 766bd32..1539ccc 100644
--- a/makefile_conf/chain/artis_sigma1.mk
+++ b/makefile_conf/chain/artis_sigma1.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/246529'"
TICKER = "ATS"
CHAIN_ID = 246529
-APPNAME = "ARTIS sigma1"
\ No newline at end of file
+APPNAME = "ARTIS sigma1"
diff --git a/makefile_conf/chain/artis_tau1.mk b/makefile_conf/chain/artis_tau1.mk
index dd0d981..720f506 100644
--- a/makefile_conf/chain/artis_tau1.mk
+++ b/makefile_conf/chain/artis_tau1.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/246785'"
TICKER = "ATS"
CHAIN_ID = 246785
-APPNAME = "ARTIS tau1"
\ No newline at end of file
+APPNAME = "ARTIS tau1"
diff --git a/makefile_conf/chain/atheios.mk b/makefile_conf/chain/atheios.mk
index e7e9ef5..77a73d7 100644
--- a/makefile_conf/chain/atheios.mk
+++ b/makefile_conf/chain/atheios.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/1620'"
TICKER = "ATH"
CHAIN_ID = 1620
-APPNAME = "Atheios"
\ No newline at end of file
+APPNAME = "Atheios"
diff --git a/makefile_conf/chain/bsc.mk b/makefile_conf/chain/bsc.mk
index dc70e0b..e3c9f6a 100644
--- a/makefile_conf/chain/bsc.mk
+++ b/makefile_conf/chain/bsc.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "BNB"
CHAIN_ID = 56
-APPNAME = "Binance Smart Chain"
\ No newline at end of file
+APPNAME = "Binance Smart Chain"
diff --git a/makefile_conf/chain/bttc.mk b/makefile_conf/chain/bttc.mk
index 9e82b67..6451337 100644
--- a/makefile_conf/chain/bttc.mk
+++ b/makefile_conf/chain/bttc.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "BTT"
CHAIN_ID = 199
-APPNAME = "BTTC"
\ No newline at end of file
+APPNAME = "BTTC"
diff --git a/makefile_conf/chain/callisto.mk b/makefile_conf/chain/callisto.mk
index 1147dc9..5919f3f 100644
--- a/makefile_conf/chain/callisto.mk
+++ b/makefile_conf/chain/callisto.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/820'"
TICKER = "CLO"
CHAIN_ID = 820
-APPNAME = "Callisto"
\ No newline at end of file
+APPNAME = "Callisto"
diff --git a/makefile_conf/chain/conflux_espace.mk b/makefile_conf/chain/conflux_espace.mk
index 6efc293..8bc8c9a 100644
--- a/makefile_conf/chain/conflux_espace.mk
+++ b/makefile_conf/chain/conflux_espace.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "CFX"
CHAIN_ID = 1030
-APPNAME = "Conflux eSpace"
\ No newline at end of file
+APPNAME = "Conflux eSpace"
diff --git a/makefile_conf/chain/cube.mk b/makefile_conf/chain/cube.mk
index 7ac424c..614036d 100644
--- a/makefile_conf/chain/cube.mk
+++ b/makefile_conf/chain/cube.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "CUBE"
CHAIN_ID = 1818
-APPNAME = "Cube"
\ No newline at end of file
+APPNAME = "Cube"
diff --git a/makefile_conf/chain/dexon.mk b/makefile_conf/chain/dexon.mk
index c892e35..7cd36b7 100644
--- a/makefile_conf/chain/dexon.mk
+++ b/makefile_conf/chain/dexon.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/237'"
TICKER = "DXN"
CHAIN_ID = 237
-APPNAME = "DEXON"
\ No newline at end of file
+APPNAME = "DEXON"
diff --git a/makefile_conf/chain/ellaism.mk b/makefile_conf/chain/ellaism.mk
index 1bd5589..27df5db 100644
--- a/makefile_conf/chain/ellaism.mk
+++ b/makefile_conf/chain/ellaism.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/163'"
TICKER = "ELLA"
CHAIN_ID = 64
-APPNAME = "Ellaism"
\ No newline at end of file
+APPNAME = "Ellaism"
diff --git a/makefile_conf/chain/ether1.mk b/makefile_conf/chain/ether1.mk
index 9efc015..1885586 100644
--- a/makefile_conf/chain/ether1.mk
+++ b/makefile_conf/chain/ether1.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/1313114'"
TICKER = "ETHO"
CHAIN_ID = 1313114
-APPNAME = "Ether-1"
\ No newline at end of file
+APPNAME = "Ether-1"
diff --git a/makefile_conf/chain/ethereum_classic.mk b/makefile_conf/chain/ethereum_classic.mk
index ac44b6a..5cc1760 100644
--- a/makefile_conf/chain/ethereum_classic.mk
+++ b/makefile_conf/chain/ethereum_classic.mk
@@ -2,4 +2,4 @@
APP_LOAD_PARAMS += --path "44'/61'" --path "44'/60'"
TICKER = "ETC"
CHAIN_ID = 61
-APPNAME = "Ethereum Classic"
\ No newline at end of file
+APPNAME = "Ethereum Classic"
diff --git a/makefile_conf/chain/ethergem.mk b/makefile_conf/chain/ethergem.mk
index 6c81976..09d3855 100644
--- a/makefile_conf/chain/ethergem.mk
+++ b/makefile_conf/chain/ethergem.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/1987'"
TICKER = "EGEM"
CHAIN_ID = 1987
-APPNAME = "EtherGem"
\ No newline at end of file
+APPNAME = "EtherGem"
diff --git a/makefile_conf/chain/ethersocial.mk b/makefile_conf/chain/ethersocial.mk
index bbf512c..95e153c 100644
--- a/makefile_conf/chain/ethersocial.mk
+++ b/makefile_conf/chain/ethersocial.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/31102'"
TICKER = "ESN"
CHAIN_ID = 31102
-APPNAME = "Ethersocial"
\ No newline at end of file
+APPNAME = "Ethersocial"
diff --git a/makefile_conf/chain/expanse.mk b/makefile_conf/chain/expanse.mk
index f2ee995..737ec43 100644
--- a/makefile_conf/chain/expanse.mk
+++ b/makefile_conf/chain/expanse.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/40'"
TICKER = "EXP"
CHAIN_ID = 2
-APPNAME = "Expanse"
\ No newline at end of file
+APPNAME = "Expanse"
diff --git a/makefile_conf/chain/flare.mk b/makefile_conf/chain/flare.mk
index 36339ee..e8ecf3b 100644
--- a/makefile_conf/chain/flare.mk
+++ b/makefile_conf/chain/flare.mk
@@ -6,4 +6,4 @@ CHAIN_ID = 14
APP_LOAD_PARAMS += --tlvraw 9F:01
DEFINES += HAVE_PENDING_REVIEW_SCREEN
-APPNAME = "Flare"
\ No newline at end of file
+APPNAME = "Flare"
diff --git a/makefile_conf/chain/flare_coston.mk b/makefile_conf/chain/flare_coston.mk
index 0d6bddf..f8f5ed2 100644
--- a/makefile_conf/chain/flare_coston.mk
+++ b/makefile_conf/chain/flare_coston.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/554'" --path "44'/60'"
TICKER = "FLR"
CHAIN_ID = 16
-APPNAME = "Flare Coston"
\ No newline at end of file
+APPNAME = "Flare Coston"
diff --git a/makefile_conf/chain/gochain.mk b/makefile_conf/chain/gochain.mk
index 180b2fd..b24e64e 100644
--- a/makefile_conf/chain/gochain.mk
+++ b/makefile_conf/chain/gochain.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/6060'"
TICKER = "GO"
CHAIN_ID = 60
-APPNAME = "GoChain"
\ No newline at end of file
+APPNAME = "GoChain"
diff --git a/makefile_conf/chain/hpb.mk b/makefile_conf/chain/hpb.mk
index 60fb3c1..03fc005 100644
--- a/makefile_conf/chain/hpb.mk
+++ b/makefile_conf/chain/hpb.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/269'"
TICKER = "HPB"
CHAIN_ID = 269
-APPNAME = "HPB"
\ No newline at end of file
+APPNAME = "HPB"
diff --git a/makefile_conf/chain/kardiachain.mk b/makefile_conf/chain/kardiachain.mk
index cc76d38..8ee40be 100644
--- a/makefile_conf/chain/kardiachain.mk
+++ b/makefile_conf/chain/kardiachain.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "KAI"
CHAIN_ID = 24
-APPNAME = "KardiaChain"
\ No newline at end of file
+APPNAME = "KardiaChain"
diff --git a/makefile_conf/chain/meter.mk b/makefile_conf/chain/meter.mk
index 2a74120..cb4554b 100644
--- a/makefile_conf/chain/meter.mk
+++ b/makefile_conf/chain/meter.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "MTR"
CHAIN_ID = 82
-APPNAME = "Meter"
\ No newline at end of file
+APPNAME = "Meter"
diff --git a/makefile_conf/chain/mix.mk b/makefile_conf/chain/mix.mk
index c180cc9..6d96ce7 100644
--- a/makefile_conf/chain/mix.mk
+++ b/makefile_conf/chain/mix.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/76'"
TICKER = "MIX"
CHAIN_ID = 76
-APPNAME = "Mix"
\ No newline at end of file
+APPNAME = "Mix"
diff --git a/makefile_conf/chain/moonbeam.mk b/makefile_conf/chain/moonbeam.mk
index 5822f8f..963ee63 100644
--- a/makefile_conf/chain/moonbeam.mk
+++ b/makefile_conf/chain/moonbeam.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'" --path "44'/1284'"
TICKER = "GLMR"
CHAIN_ID = 1284
-APPNAME = "Moonbeam"
\ No newline at end of file
+APPNAME = "Moonbeam"
diff --git a/makefile_conf/chain/moonriver.mk b/makefile_conf/chain/moonriver.mk
index 4413715..5c9391e 100644
--- a/makefile_conf/chain/moonriver.mk
+++ b/makefile_conf/chain/moonriver.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'" --path "44'/1285'"
TICKER = "MOVR"
CHAIN_ID = 1285
-APPNAME = "Moonriver"
\ No newline at end of file
+APPNAME = "Moonriver"
diff --git a/makefile_conf/chain/musicoin.mk b/makefile_conf/chain/musicoin.mk
index 188bebb..0c530d7 100644
--- a/makefile_conf/chain/musicoin.mk
+++ b/makefile_conf/chain/musicoin.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/184'"
TICKER = "MUSIC"
CHAIN_ID = 7762959
-APPNAME = "Musicoin"
\ No newline at end of file
+APPNAME = "Musicoin"
diff --git a/makefile_conf/chain/okc.mk b/makefile_conf/chain/okc.mk
index 6ed8042..9fdd4aa 100644
--- a/makefile_conf/chain/okc.mk
+++ b/makefile_conf/chain/okc.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "OKT"
CHAIN_ID = 66
-APPNAME = "OKXChain"
\ No newline at end of file
+APPNAME = "OKXChain"
diff --git a/makefile_conf/chain/pirl.mk b/makefile_conf/chain/pirl.mk
index 3f30261..fec941e 100644
--- a/makefile_conf/chain/pirl.mk
+++ b/makefile_conf/chain/pirl.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/164'"
TICKER = "PIRL"
CHAIN_ID = 3125659152
-APPNAME = "Pirl"
\ No newline at end of file
+APPNAME = "Pirl"
diff --git a/makefile_conf/chain/poa.mk b/makefile_conf/chain/poa.mk
index c415c26..dd9f32e 100644
--- a/makefile_conf/chain/poa.mk
+++ b/makefile_conf/chain/poa.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "POA"
CHAIN_ID = 99
-APPNAME = "POA"
\ No newline at end of file
+APPNAME = "POA"
diff --git a/makefile_conf/chain/polygon.mk b/makefile_conf/chain/polygon.mk
index 9bdf2dc..0348401 100644
--- a/makefile_conf/chain/polygon.mk
+++ b/makefile_conf/chain/polygon.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "MATIC"
CHAIN_ID = 137
-APPNAME = "Polygon"
\ No newline at end of file
+APPNAME = "Polygon"
diff --git a/makefile_conf/chain/reosc.mk b/makefile_conf/chain/reosc.mk
index 9f9cedf..662e8a2 100644
--- a/makefile_conf/chain/reosc.mk
+++ b/makefile_conf/chain/reosc.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/2894'"
TICKER = "REOSC"
CHAIN_ID = 2894
-APPNAME = "REOSC"
\ No newline at end of file
+APPNAME = "REOSC"
diff --git a/makefile_conf/chain/rsk.mk b/makefile_conf/chain/rsk.mk
index dad8f56..bdbef87 100644
--- a/makefile_conf/chain/rsk.mk
+++ b/makefile_conf/chain/rsk.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/137'" --path "44'/00'"
TICKER = "RBTC"
CHAIN_ID = 30
-APPNAME = "RSK"
\ No newline at end of file
+APPNAME = "RSK"
diff --git a/makefile_conf/chain/rsk_testnet.mk b/makefile_conf/chain/rsk_testnet.mk
index 2142f7c..8caa3a7 100644
--- a/makefile_conf/chain/rsk_testnet.mk
+++ b/makefile_conf/chain/rsk_testnet.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/37310'"
TICKER = "RBTC"
CHAIN_ID = 31
-APPNAME = "RSK Test"
\ No newline at end of file
+APPNAME = "RSK Test"
diff --git a/makefile_conf/chain/shyft.mk b/makefile_conf/chain/shyft.mk
index b578933..71ead2b 100644
--- a/makefile_conf/chain/shyft.mk
+++ b/makefile_conf/chain/shyft.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/60'"
TICKER = "SHFT"
CHAIN_ID = 7341
-APPNAME = "Shyft"
\ No newline at end of file
+APPNAME = "Shyft"
diff --git a/makefile_conf/chain/songbird.mk b/makefile_conf/chain/songbird.mk
index bc11a41..4c767ee 100644
--- a/makefile_conf/chain/songbird.mk
+++ b/makefile_conf/chain/songbird.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/554'" --path "44'/60'"
TICKER = "SGB"
CHAIN_ID = 19
-APPNAME = "Songbird"
\ No newline at end of file
+APPNAME = "Songbird"
diff --git a/makefile_conf/chain/tecracoin.mk b/makefile_conf/chain/tecracoin.mk
index eabc826..87a94ff 100644
--- a/makefile_conf/chain/tecracoin.mk
+++ b/makefile_conf/chain/tecracoin.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/554'" --path "44'/60'"
TICKER = "TCR"
CHAIN_ID = 20531812
-APPNAME = "TecraCoin"
\ No newline at end of file
+APPNAME = "TecraCoin"
diff --git a/makefile_conf/chain/tecratestnet.mk b/makefile_conf/chain/tecratestnet.mk
index d97ab81..1be7c06 100644
--- a/makefile_conf/chain/tecratestnet.mk
+++ b/makefile_conf/chain/tecratestnet.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/554'" --path "44'/60'"
TICKER = "TCR"
CHAIN_ID = 20531811
-APPNAME = "TecraTestnet"
\ No newline at end of file
+APPNAME = "TecraTestnet"
diff --git a/makefile_conf/chain/thundercore.mk b/makefile_conf/chain/thundercore.mk
index a7a4ddd..ea63c1a 100644
--- a/makefile_conf/chain/thundercore.mk
+++ b/makefile_conf/chain/thundercore.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/1001'"
TICKER = "TT"
CHAIN_ID = 108
-APPNAME = "ThunderCore"
\ No newline at end of file
+APPNAME = "ThunderCore"
diff --git a/makefile_conf/chain/tomochain.mk b/makefile_conf/chain/tomochain.mk
index 9538308..19e2f4b 100644
--- a/makefile_conf/chain/tomochain.mk
+++ b/makefile_conf/chain/tomochain.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/889'"
TICKER = "TOMO"
CHAIN_ID = 88
-APPNAME = "TomoChain"
\ No newline at end of file
+APPNAME = "TomoChain"
diff --git a/makefile_conf/chain/ubiq.mk b/makefile_conf/chain/ubiq.mk
index 62a4ba1..840d304 100644
--- a/makefile_conf/chain/ubiq.mk
+++ b/makefile_conf/chain/ubiq.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/108'"
TICKER = "UBQ"
CHAIN_ID = 8
-APPNAME = "Ubiq"
\ No newline at end of file
+APPNAME = "Ubiq"
diff --git a/makefile_conf/chain/volta.mk b/makefile_conf/chain/volta.mk
index 28f7c56..9230cbc 100644
--- a/makefile_conf/chain/volta.mk
+++ b/makefile_conf/chain/volta.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/73799'" --path "44'/60'"
TICKER = "VOLTA"
CHAIN_ID = 73799
-APPNAME = "Volta"
\ No newline at end of file
+APPNAME = "Volta"
diff --git a/makefile_conf/chain/webchain.mk b/makefile_conf/chain/webchain.mk
index 3a7da24..f2bb364 100644
--- a/makefile_conf/chain/webchain.mk
+++ b/makefile_conf/chain/webchain.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/227'"
TICKER = "WEB"
CHAIN_ID = 24484
-APPNAME = "Webchain"
\ No newline at end of file
+APPNAME = "Webchain"
diff --git a/makefile_conf/chain/wethio.mk b/makefile_conf/chain/wethio.mk
index fc491df..11b29d7 100644
--- a/makefile_conf/chain/wethio.mk
+++ b/makefile_conf/chain/wethio.mk
@@ -1,4 +1,4 @@
APP_LOAD_PARAMS += --path "44'/77777'"
TICKER = "ZYN"
CHAIN_ID = 78
-APPNAME = "Wethio"
\ No newline at end of file
+APPNAME = "Wethio"
diff --git a/src/ethUstream.c b/src/ethUstream.c
index 42c29fa..3737dc2 100644
--- a/src/ethUstream.c
+++ b/src/ethUstream.c
@@ -518,7 +518,7 @@ static parserStatus_e processTxInternal(txContext_t *context) {
PRINTF("parsing is done\n");
return USTREAM_FINISHED;
}
- // Old style transaction (pre EIP-155). Transations could just skip `v,r,s` so we needed to
+ // Old style transaction (pre EIP-155). Transactions could just skip `v,r,s` so we needed to
// cut parsing here. commandLength == 0 could happen in two cases :
// 1. We are in an old style transaction : just return `USTREAM_FINISHED`.
// 2. We are at the end of an APDU in a multi-apdu process. This would make us return
diff --git a/src/main.c b/src/main.c
index eb2109b..24d2f63 100644
--- a/src/main.c
+++ b/src/main.c
@@ -412,7 +412,7 @@ void handleApdu(unsigned int *flags, unsigned int *tx) {
// If we are in swap mode and have validated a TX, we send it and immediately quit
if (quit_now) {
if (io_exchange(CHANNEL_APDU | IO_RETURN_AFTER_TX, *tx) == 0) {
- // In case of success, the apdu is sent immediatly and eth exits
+ // In case of success, the apdu is sent immediately and eth exits
// Reaching this code means we encountered an error
finalize_exchange_sign_transaction(false);
} else {
diff --git a/src/network.c b/src/network.c
index 1563c32..f16832f 100644
--- a/src/network.c
+++ b/src/network.c
@@ -13,7 +13,7 @@ typedef struct network_info_s {
static const char *unknown_ticker = "???";
-// Mappping of chain ids to networks.
+// Mapping of chain ids to networks.
static const network_info_t NETWORK_MAPPING[] = {
{.chain_id = 1, .name = "Ethereum", .ticker = "ETH"},
{.chain_id = 3, .name = "Ropsten", .ticker = "ETH"},
@@ -153,7 +153,7 @@ const char *get_displayable_ticker(const uint64_t *chain_id, const chain_config_
}
/**
- * Checks wether the app can support the given chain ID
+ * Checks whether the app can support the given chain ID
*
* - If the given chain ID is the same as the app's one
* - If both chain IDs are present in the array of Ethereum-compatible networks
diff --git a/src/plugins.c b/src/plugins.c
index 42c17a9..0256979 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -37,4 +37,4 @@ void plugin_ui_get_item(void) {
sizeof(strings.common.fullAddress),
strings.common.fullAmount,
sizeof(strings.common.fullAmount));
-}
\ No newline at end of file
+}
diff --git a/src/plugins.h b/src/plugins.h
index 1ccc123..df406c0 100644
--- a/src/plugins.h
+++ b/src/plugins.h
@@ -8,4 +8,4 @@ void plugin_ui_get_item_internal(uint8_t *title_buffer,
uint8_t *msg_buffer,
size_t msg_buffer_size);
-#endif // _PLUGIN_H_
\ No newline at end of file
+#endif // _PLUGIN_H_
diff --git a/src_bagl/ui_flow_performPrivacyOperation.c b/src_bagl/ui_flow_performPrivacyOperation.c
index 5c181ef..8c870c0 100644
--- a/src_bagl/ui_flow_performPrivacyOperation.c
+++ b/src_bagl/ui_flow_performPrivacyOperation.c
@@ -3,7 +3,7 @@
// clang-format off
UX_STEP_NOCB(
- ux_display_privacy_public_key_flow_1_step,
+ ux_display_privacy_public_key_flow_1_step,
pnn,
{
&C_icon_eye,
@@ -11,21 +11,21 @@ UX_STEP_NOCB(
"privacy key",
});
UX_STEP_NOCB(
- ux_display_privacy_public_key_flow_2_step,
+ ux_display_privacy_public_key_flow_2_step,
bnnn_paging,
{
.title = "Address",
.text = strings.common.fullAddress,
});
UX_STEP_NOCB(
- ux_display_privacy_public_key_flow_3_step,
+ ux_display_privacy_public_key_flow_3_step,
bnnn_paging,
{
.title = "Key",
.text = strings.common.fullAmount,
});
UX_STEP_CB(
- ux_display_privacy_public_key_flow_4_step,
+ ux_display_privacy_public_key_flow_4_step,
pb,
io_seproxyhal_touch_privacy_ok(NULL),
{
@@ -33,7 +33,7 @@ UX_STEP_CB(
"Approve",
});
UX_STEP_CB(
- ux_display_privacy_public_key_flow_5_step,
+ ux_display_privacy_public_key_flow_5_step,
pb,
io_seproxyhal_touch_privacy_cancel(NULL),
{
diff --git a/src_bagl/ui_plugin.c b/src_bagl/ui_plugin.c
index c3743fa..e493bd9 100644
--- a/src_bagl/ui_plugin.c
+++ b/src_bagl/ui_plugin.c
@@ -46,4 +46,4 @@ void display_next_plugin_item(bool entering) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src_common/eth_plugin_interface.h b/src_common/eth_plugin_interface.h
index 9821836..6d872f5 100644
--- a/src_common/eth_plugin_interface.h
+++ b/src_common/eth_plugin_interface.h
@@ -90,7 +90,7 @@ typedef struct ethPluginSharedRO_s {
// Plugin-only memory allocated by the Ethereum application and used by the plugin.
#define PLUGIN_CONTEXT_SIZE (5 * INT256_LENGTH)
-// It is recommended to cast the raw uin8_t array to a structure meaningfull for your plugin
+// It is recommended to cast the raw uin8_t array to a structure meaningful for your plugin
// Helper to check that the actual plugin context structure is not bigger than the allocated memory
#define ASSERT_SIZEOF_PLUGIN_CONTEXT(s) \
_Static_assert(sizeof(s) <= PLUGIN_CONTEXT_SIZE, "Plugin context structure is too big.")
diff --git a/src_features/provideDomainName/cmd_provide_domain_name.c b/src_features/provideDomainName/cmd_provide_domain_name.c
index dcce5f5..cfcdc0d 100644
--- a/src_features/provideDomainName/cmd_provide_domain_name.c
+++ b/src_features/provideDomainName/cmd_provide_domain_name.c
@@ -444,7 +444,7 @@ static bool check_found_tlv_tags(s_tlv_handler *handlers, int handler_count) {
// prevent missing or duplicated tags
for (int idx = 0; idx < handler_count; ++idx) {
if (handlers[idx].found != 1) {
- PRINTF("Found %u occurence(s) of tag 0x%x in TLV!\n",
+ PRINTF("Found %u occurrence(s) of tag 0x%x in TLV!\n",
handlers[idx].found,
handlers[idx].tag);
return false;
diff --git a/src_features/provideNFTInformation/cmd_provideNFTInfo.c b/src_features/provideNFTInformation/cmd_provideNFTInfo.c
index 1d6ab60..a9685ce 100644
--- a/src_features/provideNFTInformation/cmd_provideNFTInfo.c
+++ b/src_features/provideNFTInformation/cmd_provideNFTInfo.c
@@ -174,7 +174,7 @@ void handleProvideNFTInformation(uint8_t p1,
}
uint8_t signatureLen = workBuffer[offset];
- PRINTF("Sigature len: %d\n", signatureLen);
+ PRINTF("Signature len: %d\n", signatureLen);
if (signatureLen < MIN_DER_SIG_SIZE || signatureLen > MAX_DER_SIG_SIZE) {
PRINTF("SignatureLen too big or too small. Must be between %d and %d, got %d\n",
MIN_DER_SIG_SIZE,
diff --git a/src_features/setPlugin/cmd_setPlugin.c b/src_features/setPlugin/cmd_setPlugin.c
index 1b80bb5..d083d9b 100644
--- a/src_features/setPlugin/cmd_setPlugin.c
+++ b/src_features/setPlugin/cmd_setPlugin.c
@@ -58,7 +58,7 @@ typedef bool verificationAlgo(const cx_ecfp_public_key_t *,
// Returns the plugin type of a given plugin name.
// If the plugin name is not a specific known internal plugin, this function default return value is
-// `EXERNAL`.
+// `EXTERNAL`.
static pluginType_t getPluginType(char *pluginName, uint8_t pluginNameLength) {
if (pluginNameLength == sizeof(ERC721_STR) - 1 &&
strncmp(pluginName, ERC721_STR, pluginNameLength) == 0) {
diff --git a/src_features/signMessageEIP712/field_hash.c b/src_features/signMessageEIP712/field_hash.c
index d97d5ee..0ea583c 100644
--- a/src_features/signMessageEIP712/field_hash.c
+++ b/src_features/signMessageEIP712/field_hash.c
@@ -173,7 +173,7 @@ static void field_hash_feed_parent(e_type field_type, const uint8_t *const hash)
* @param[in] field_ptr pointer to the struct field definition
* @param[in] data the field value
* @param[in] data_length the value length
- * @return whether an error occured or not
+ * @return whether an error occurred or not
*/
static bool field_hash_domain_special_fields(const void *const field_ptr,
const uint8_t *const data,
@@ -202,7 +202,7 @@ static bool field_hash_domain_special_fields(const void *const field_ptr,
* @param[in] field_ptr pointer to the struct field definition
* @param[in] data the field value
* @param[in] data_length the value length
- * @return whether an error occured or not
+ * @return whether an error occurred or not
*/
static bool field_hash_finalize(const void *const field_ptr,
const uint8_t *const data,
diff --git a/src_features/signMessageEIP712/path.c b/src_features/signMessageEIP712/path.c
index 9cf5477..8a5d05d 100644
--- a/src_features/signMessageEIP712/path.c
+++ b/src_features/signMessageEIP712/path.c
@@ -115,7 +115,7 @@ const void *path_get_field(void) {
/**
* Go down (add) a depth level.
*
- * @return whether the push was succesful
+ * @return whether the push was successful
*/
static bool path_depth_list_push(void) {
if (path_struct == NULL) {
diff --git a/src_features/signMessageEIP712/type_hash.c b/src_features/signMessageEIP712/type_hash.c
index aa2ecfe..f37e208 100644
--- a/src_features/signMessageEIP712/type_hash.c
+++ b/src_features/signMessageEIP712/type_hash.c
@@ -51,7 +51,7 @@ static bool encode_and_hash_type(const void *const struct_ptr) {
struct_name = get_struct_name(struct_ptr, &struct_name_length);
hash_nbytes((uint8_t *) struct_name, struct_name_length, (cx_hash_t *) &global_sha3);
- // opening struct parenthese
+ // opening struct parentheses
hash_byte('(', (cx_hash_t *) &global_sha3);
field_ptr = get_struct_fields_array(struct_ptr, &fields_count);
@@ -67,7 +67,7 @@ static bool encode_and_hash_type(const void *const struct_ptr) {
field_ptr = get_next_struct_field(field_ptr);
}
- // closing struct parenthese
+ // closing struct parentheses
hash_byte(')', (cx_hash_t *) &global_sha3);
return true;
@@ -107,7 +107,7 @@ static void sort_dependencies(uint8_t deps_count, const void **deps) {
/**
* Find all the dependencies from a given structure
*
- * @param[out] deps_count count of how many struct dependencie pointers
+ * @param[out] deps_count count of how many struct dependency pointers
* @param[in] first_dep pointer to the first dependency pointer
* @param[in] struct_ptr pointer to the struct we are getting the dependencies of
* @return pointer to the first found dependency, \ref NULL otherwise
diff --git a/src_features/signMessageEIP712/ui_logic.c b/src_features/signMessageEIP712/ui_logic.c
index c4bf9d9..88951d7 100644
--- a/src_features/signMessageEIP712/ui_logic.c
+++ b/src_features/signMessageEIP712/ui_logic.c
@@ -48,7 +48,7 @@ static bool ui_712_field_shown(void) {
* @param[in] src_length source buffer size
* @param[in] dst destination buffer
* @param[in] dst_length destination buffer length
- * @param[in] explicit_trunc if truncation should be explicitely shown
+ * @param[in] explicit_trunc if truncation should be explicitly shown
*/
static void ui_712_set_buf(const char *const src,
size_t src_length,
@@ -194,7 +194,7 @@ static void ui_712_format_str(const uint8_t *const data, uint8_t length) {
static const char *get_address_token_ticker(const uint8_t *addr) {
tokenDefinition_t *token;
- // Loop over the received token informations
+ // Loop over the received token information
for (uint8_t token_idx = 0; token_idx < MAX_ITEMS; ++token_idx) {
if (tmpCtx.transactionContext.tokenSet[token_idx] == 1) {
token = &tmpCtx.transactionContext.extraInfo[token_idx].token;
diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c
index 99d6824..20c1375 100644
--- a/src_features/signTx/logic_signTx.c
+++ b/src_features/signTx/logic_signTx.c
@@ -296,7 +296,7 @@ static void get_public_key(uint8_t *out, uint8_t outLength) {
getEthAddressFromRawKey(raw_pubkey, out);
}
-/* Local implmentation of strncasecmp, workaround of the segfaulting base implem
+/* Local implementation of strncasecmp, workaround of the segfaulting base implem
* Remove once strncasecmp is fixed
*/
static int strcasecmp_workaround(const char *str1, const char *str2) {
diff --git a/src_nbgl/ui_get_eth2_public_key.c b/src_nbgl/ui_get_eth2_public_key.c
index 9f388df..3f6a3e7 100644
--- a/src_nbgl/ui_get_eth2_public_key.c
+++ b/src_nbgl/ui_get_eth2_public_key.c
@@ -27,4 +27,4 @@ static void buildScreen(void) {
void ui_display_public_eth2(void) {
buildScreen();
-}
\ No newline at end of file
+}
diff --git a/tests/speculos/.gitignore b/tests/speculos/.gitignore
index 94026aa..a6d415f 100644
--- a/tests/speculos/.gitignore
+++ b/tests/speculos/.gitignore
@@ -22,4 +22,4 @@ pytestdebug.log
.mypy_cache
.coverage
.coverage.*
-coverage.xml
\ No newline at end of file
+coverage.xml
diff --git a/tests/speculos/README.md b/tests/speculos/README.md
index 68d1468..3cc7fd3 100644
--- a/tests/speculos/README.md
+++ b/tests/speculos/README.md
@@ -8,6 +8,7 @@ These tests are implemented in Python with the `SpeculosClient` interface which
- [pip](https://pip.pypa.io/en/stable/installation/)
### Dependencies
+
Python dependencies are listed in [requirements.txt](requirements.txt)
```shell
@@ -19,6 +20,7 @@ python3 -m pip install -r requirements.txt
### Compilation app
Go to the root of the repository:
+
```sh
make DEBUG=1 NFT_TESTING_KEY=1 BOLOS_SDK=$NANOX_SDK
mv bin/app.elf tests/speculos/.elf
@@ -26,12 +28,13 @@ mv bin/app.elf tests/speculos/.elf
Given the requirements are installed, just do (by default command):
-```
+```shell
cd tests/speculos/
pytest
```
### Custom options
+
- **--model:** "nanos", "nanox", "nanosp" | default: "nanos"
- **--display:** "qt", "headless" | default: "qt"
- **--path:** the path of the binary app | default: path of makefile compilation
@@ -39,6 +42,7 @@ pytest
## Example
With `nanox` binary app:
+
```sh
# the --path is variable to where you put your binary
diff --git a/tests/speculos/docs/README.md b/tests/speculos/docs/README.md
index eb6df71..8a10e58 100644
--- a/tests/speculos/docs/README.md
+++ b/tests/speculos/docs/README.md
@@ -32,6 +32,7 @@
## Ethereum_client
### Ethereum_cmd_builder
+
```py
def chunked(size, source)
@@ -49,6 +50,7 @@ class EthereumCommandBuilder:
```
### Ethereum_cmd
+
```py
class EthereumCommand:
# Sending apdu and parsing the response in the right form
@@ -61,16 +63,14 @@ class EthereumCommand:
def simple_sign_tx(self, bip32_path: str, transaction: Transaction, result: List = list()) -> None:
def sign_eip712(self, bip32_path: str, transaction: EIP712, result: List = list()) -> None:
def personal_sign_tx(self, bip32_path: str, transaction: PersonalTransaction, result: List = list()) -> None:
-
-
# Allows to send an apdu without return of speculos
def send_apdu(self, apdu: bytes) -> bytes:
# Allows to send an apdu with return of speculos
def send_apdu_context(self, apdu: bytes, result: List = list()) -> bytes:
-
```
### Utils
+
```py
def save_screenshot(cmd, path: str):
def compare_screenshot(cmd, path: str):
@@ -80,21 +80,23 @@ def packed_bip32_path_from_string(path: str) -> bytes:
def write_varint(n: int) -> bytes:
def read_varint(buf: BytesIO, prefix: Optional[bytes] = None) -> int:
def read(buf: BytesIO, size: int) -> bytes:
-def read_uint(buf: BytesIO,
+def read_uint(buf: BytesIO, bit_len: int, byteorder: Literal['big', 'little'] = 'little') -> int:
```
## Tests new apdu
-If a new instruction is programmed it will be necessary to create 2 new functions.
-one in `ethereum_cmd_builder` :
+If a new instruction is programmed it will be necessary to create 2 new functions.
+one in `ethereum_cmd_builder`:
+
- Creation of the raw apdu you can find some examples in this same file
-
-and one in `ethereum_cmd`:
+
+and one in `ethereum_cmd`:
+
- Send the apdu to speculos and parse the answer in a `list` named result you can find some examples in this same file
## Example for write new tests
-To send several apdu and get the return
+To send several apdu and get the return
```py
FIRST = bytes.fromhex("{YourAPDU}")
@@ -130,4 +132,3 @@ def test_some_error(cmd):
pass
assert error.args[0] == '0x6a80'
```
-
diff --git a/tests/speculos/ethereum_client/ethereum_cmd.py b/tests/speculos/ethereum_client/ethereum_cmd.py
index a13a817..8c575af 100644
--- a/tests/speculos/ethereum_client/ethereum_cmd.py
+++ b/tests/speculos/ethereum_client/ethereum_cmd.py
@@ -22,7 +22,7 @@ class EthereumCommand:
self.builder = EthereumCommandBuilder(debug=debug)
self.debug = debug
self.model = model
-
+
def get_configuration(self) -> Tuple[int, int, int, int]:
try:
response = self.client._apdu_exchange(
@@ -46,7 +46,7 @@ class EthereumCommand:
self.client._apdu_exchange(
self.builder.set_plugin(plugin=plugin)
)
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_SET_PLUGIN)
@@ -79,7 +79,7 @@ class EthereumCommand:
data=chunk[5:]) as exchange:
yield exchange
response: bytes = exchange.receive()
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_GET_PUBLIC_KEY)
@@ -94,17 +94,17 @@ class EthereumCommand:
uncompressed_addr_len: bytes = response[offset:offset + pub_key_len]
offset += pub_key_len
-
+
eth_addr_len: int = response[offset]
offset += 1
-
+
eth_addr: bytes = response[offset:offset + eth_addr_len]
offset += eth_addr_len
chain_code: bytes = response[offset:]
assert len(response) == 1 + pub_key_len + 1 + eth_addr_len + 32 # 32 -> chain_code_len
-
+
result.append(uncompressed_addr_len)
result.append(eth_addr)
result.append(chain_code)
@@ -120,7 +120,7 @@ class EthereumCommand:
data=chunk[5:]) as exchange:
yield exchange
response: bytes = exchange.receive()
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_PERFORM_PRIVACY_OPERATION)
@@ -146,7 +146,7 @@ class EthereumCommand:
data=apdu[5:]) as exchange:
yield exchange
result.append(exchange.receive())
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_SIGN_TX)
@@ -162,14 +162,14 @@ class EthereumCommand:
data=chunk[5:]) as exchange:
yield exchange
response: bytes = exchange.receive()
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_SIGN_TX)
# response = V (1) || R (32) || S (32)
assert len(response) == 65
v, r, s = parse_sign_response(response)
-
+
result.append(v)
result.append(r)
result.append(s)
@@ -185,14 +185,14 @@ class EthereumCommand:
data=chunk[5:]) as exchange:
yield exchange
response: bytes = exchange.receive()
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_SIGN_EIP712)
# response = V (1) || R (32) || S (32)
assert len(response) == 65
v, r, s = parse_sign_response(response)
-
+
result.append(v)
result.append(r)
result.append(s)
@@ -211,16 +211,13 @@ class EthereumCommand:
response: bytes = exchange.receive()
else:
self.send_apdu(apdu)
-
+
except ApduException as error:
raise DeviceException(error_code=error.sw, ins=InsType.INS_SIGN_TX)
# response = V (1) || R (32) || S (32)
v, r, s = parse_sign_response(response)
-
+
result.append(v)
result.append(r)
result.append(s)
-
-
-
diff --git a/tests/speculos/ethereum_client/ethereum_cmd_builder.py b/tests/speculos/ethereum_client/ethereum_cmd_builder.py
index f2f721e..dd516d4 100644
--- a/tests/speculos/ethereum_client/ethereum_cmd_builder.py
+++ b/tests/speculos/ethereum_client/ethereum_cmd_builder.py
@@ -156,7 +156,7 @@ class EthereumCommandBuilder:
"""
cdata = packed_bip32_path_from_string(bip32_path)
-
+
return self.serialize(cla=self.CLA,
ins=InsType.INS_GET_PUBLIC_KEY,
p1=0x01 if display else 0x00,
@@ -171,11 +171,11 @@ class EthereumCommandBuilder:
bip32_path : str
String representation of BIP32 path.
Third party public key on Curve25519 : 32 bytes
- Optionnal if returning the shared secret
-
+ Optional if returning the shared secret
+
"""
cdata = packed_bip32_path_from_string(bip32_path)
-
+
return self.serialize(cla=self.CLA,
ins=InsType.INS_PERFORM_PRIVACY_OPERATION,
p1=0x01 if display else 0x00,
@@ -200,7 +200,7 @@ class EthereumCommandBuilder:
"""
cdata = packed_bip32_path_from_string(bip32_path)
-
+
tx: bytes = transaction.serialize()
cdata = cdata + tx
@@ -230,7 +230,7 @@ class EthereumCommandBuilder:
"""
cdata = packed_bip32_path_from_string(bip32_path)
-
+
tx: bytes = transaction.serialize()
cdata = cdata + tx
@@ -259,12 +259,12 @@ class EthereumCommandBuilder:
"""
cdata = packed_bip32_path_from_string(bip32_path)
-
+
tx: bytes = transaction.serialize()
cdata = cdata + tx
last_chunk = len(cdata) // MAX_APDU_LEN
-
+
# The generator allows to send apdu frames because we can't send an apdu > 255
for i, (chunk) in enumerate(chunked(MAX_APDU_LEN, cdata)):
if i == 0 and i == last_chunk:
@@ -290,4 +290,4 @@ class EthereumCommandBuilder:
ins=InsType.INS_SIGN_PERSONAL_TX,
p1=0x80,
p2=0x00,
- cdata=chunk)
\ No newline at end of file
+ cdata=chunk)
diff --git a/tests/speculos/ethereum_client/plugin.py b/tests/speculos/ethereum_client/plugin.py
index 9274fde..88e7892 100644
--- a/tests/speculos/ethereum_client/plugin.py
+++ b/tests/speculos/ethereum_client/plugin.py
@@ -10,7 +10,7 @@ class ERC20Information:
self.nb_decimals: int = nb_decimals
self.chainID: int = chainID
self.sign: bytes = bytes.fromhex(sign)
-
+
def serialize(self) -> bytes:
return b"".join([
write_varint(len(self.erc20_ticker)),
@@ -67,4 +67,4 @@ class Plugin:
write_varint(len(self.sign)),
self.sign,
- ])
\ No newline at end of file
+ ])
diff --git a/tests/speculos/ethereum_client/transaction.py b/tests/speculos/ethereum_client/transaction.py
index 4c9fe23..64b261b 100644
--- a/tests/speculos/ethereum_client/transaction.py
+++ b/tests/speculos/ethereum_client/transaction.py
@@ -88,9 +88,9 @@ class EIP712:
def __init__(self, domain_hash: str, msg_hash: str) -> None:
self.domain_hash = bytes.fromhex(domain_hash)
self.msg_hash = bytes.fromhex(msg_hash)
-
+
def serialize(self) -> bytes:
return b"".join([
self.domain_hash,
self.msg_hash
- ])
\ No newline at end of file
+ ])
diff --git a/tests/speculos/ethereum_client/utils.py b/tests/speculos/ethereum_client/utils.py
index be3cdde..de03b78 100644
--- a/tests/speculos/ethereum_client/utils.py
+++ b/tests/speculos/ethereum_client/utils.py
@@ -54,7 +54,7 @@ def bip32_path_from_string(path: str) -> List[bytes]:
def packed_bip32_path_from_string(path: str) -> bytes:
bip32_paths = bip32_path_from_string(path)
-
+
return b"".join([
len(bip32_paths).to_bytes(1, byteorder="big"),
*bip32_paths
@@ -98,7 +98,7 @@ def read(buf: BytesIO, size: int) -> bytes:
b: bytes = buf.read(size)
if len(b) < size:
- raise ValueError(f"Cant read {size} bytes in buffer!")
+ raise ValueError(f"Can't read {size} bytes in buffer!")
return b
diff --git a/tests/speculos/old_test_eip191.py b/tests/speculos/old_test_eip191.py
index d24ad0b..423bd23 100644
--- a/tests/speculos/old_test_eip191.py
+++ b/tests/speculos/old_test_eip191.py
@@ -16,7 +16,7 @@ def test_personal_sign_metamask(cmd):
with cmd.personal_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Sign message
compare_screenshot(cmd, f"screenshots/eip191/{PATH_IMG[cmd.model]}/personal_sign_metamask/00000.png")
@@ -49,7 +49,7 @@ def test_personal_sign_metamask(cmd):
assert v == 0x1c # 28
assert r.hex() == "916099cf0d9c21911c85f0770a47a9696a8189e78c259cf099749748c507baae"
assert s.hex() == "0d72234bc0ac2e94c5f7a5f4f9cd8610a52be4ea55515a85b9703f1bb158415c"
-
+
def test_personal_sign_reject(cmd):
result: list = []
@@ -109,7 +109,7 @@ def test_personal_sign_non_ascii(cmd):
with cmd.personal_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Sign message
compare_screenshot(cmd, f"screenshots/eip191/{PATH_IMG[cmd.model]}/personal_sign_non_ascii/00000.png")
@@ -159,7 +159,7 @@ def test_personal_sign_opensea(cmd):
with cmd.personal_sign_tx(bip32_path, transaction, result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Sign message
compare_screenshot(cmd, f"screenshots/eip191/{PATH_IMG[cmd.model]}/personal_sign_opensea/00000.png")
diff --git a/tests/speculos/test_eip1559.py b/tests/speculos/test_eip1559.py
index f834df3..62cb43a 100644
--- a/tests/speculos/test_eip1559.py
+++ b/tests/speculos/test_eip1559.py
@@ -9,7 +9,7 @@ def test_sign_eip_1559(cmd):
with cmd.send_apdu_context(apdu_sign_eip_1559, result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Review transaction
compare_screenshot(cmd, f"screenshots/eip1559/{PATH_IMG[cmd.model]}/sign_eip_1559/00000.png")
@@ -47,7 +47,7 @@ def test_sign_eip_1559(cmd):
# Address
compare_screenshot(cmd, f"screenshots/eip1559/{PATH_IMG[cmd.model]}/sign_eip_1559/00002.png")
cmd.client.press_and_release('right')
-
+
# Max Fees
compare_screenshot(cmd, f"screenshots/eip1559/{PATH_IMG[cmd.model]}/sign_eip_1559/00003.png")
cmd.client.press_and_release('right')
diff --git a/tests/speculos/test_eip712.py b/tests/speculos/test_eip712.py
index 6a72aa4..161e6ee 100644
--- a/tests/speculos/test_eip712.py
+++ b/tests/speculos/test_eip712.py
@@ -176,4 +176,4 @@ def test_sign_eip_712_bad_msg(cmd):
with cmd.sign_eip712(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
pass
- assert error.args[0] == '0x6a80'
\ No newline at end of file
+ assert error.args[0] == '0x6a80'
diff --git a/tests/speculos/test_erc1155.py b/tests/speculos/test_erc1155.py
index b0692ec..f3948a4 100644
--- a/tests/speculos/test_erc1155.py
+++ b/tests/speculos/test_erc1155.py
@@ -38,7 +38,7 @@ def test_transfer_erc1155(cmd):
if cmd.model == "nanox" or cmd.model == "nanosp":
cmd.set_plugin(plugin=PLUGIN)
cmd.provide_nft_information(plugin=PROVIDE_NFT_INFORMATION)
-
+
cmd.send_apdu(SIGN_FIRST)
with cmd.send_apdu_context(SIGN_MORE, result) as ex:
@@ -46,8 +46,8 @@ def test_transfer_erc1155(cmd):
# Review transaction
compare_screenshot(cmd, f"screenshots/erc1155/{PATH_IMG[cmd.model]}/transfer_erc1155/00000.png")
cmd.client.press_and_release('right')
-
- # NFT Transfert
+
+ # NFT Transfer
compare_screenshot(cmd, f"screenshots/erc1155/{PATH_IMG[cmd.model]}/transfer_erc1155/00001.png")
cmd.client.press_and_release('right')
@@ -98,7 +98,7 @@ def test_transfer_erc1155_without_nft_provide_info(cmd):
cmd.set_plugin(plugin=PLUGIN)
-
+
cmd.send_apdu(SIGN_FIRST)
with cmd.send_apdu_context(SIGN_MORE, result) as ex:
@@ -114,7 +114,7 @@ def test_transfer_erc1155_without_set_plugin(cmd):
with pytest.raises(ethereum_client.exception.errors.DenyError) as error:
cmd.provide_nft_information(plugin=PROVIDE_NFT_INFORMATION)
-
+
cmd.send_apdu(SIGN_FIRST)
with cmd.send_apdu_context(SIGN_MORE, result) as ex:
@@ -161,7 +161,7 @@ def test_transfer_batch_erc1155(cmd):
if cmd.model == "nanox" or cmd.model == "nanosp":
cmd.set_plugin(plugin=PLUGIN_BATCH)
cmd.provide_nft_information(plugin=PROVIDE_NFT_INFORMATION_BATCH)
-
+
cmd.send_apdu(SIGN_FIRST_BATCH)
cmd.send_apdu(SIGN_MORE_1_BATCH)
cmd.send_apdu(SIGN_MORE_2_BATCH)
diff --git a/tests/speculos/test_erc20information.py b/tests/speculos/test_erc20information.py
index 9af2c7b..de01c63 100644
--- a/tests/speculos/test_erc20information.py
+++ b/tests/speculos/test_erc20information.py
@@ -28,4 +28,4 @@ def test_provide_erc20_token_error(cmd):
with pytest.raises(ethereum_client.exception.errors.UnknownDeviceError) as error:
cmd.provide_erc20_token_information(info=erc20_info)
- assert error.args[0] == '0x6a80'
\ No newline at end of file
+ assert error.args[0] == '0x6a80'
diff --git a/tests/speculos/test_erc721.py b/tests/speculos/test_erc721.py
index 8652501..c492f65 100644
--- a/tests/speculos/test_erc721.py
+++ b/tests/speculos/test_erc721.py
@@ -38,7 +38,7 @@ def test_transfer_erc721(cmd):
if cmd.model == "nanox" or cmd.model == "nanosp":
cmd.set_plugin(plugin=PLUGIN)
cmd.provide_nft_information(plugin=PROVIDE_NFT_INFORMATION)
-
+
cmd.send_apdu(SIGN_FIRST)
with cmd.send_apdu_context(SIGN_MORE, result) as ex:
@@ -46,7 +46,7 @@ def test_transfer_erc721(cmd):
# Review transaction
compare_screenshot(cmd, f"screenshots/erc721/{PATH_IMG[cmd.model]}/transfer_erc721/00000.png")
cmd.client.press_and_release('right')
-
+
# NFT Transfer
compare_screenshot(cmd, f"screenshots/erc721/{PATH_IMG[cmd.model]}/transfer_erc721/00001.png")
cmd.client.press_and_release('right')
@@ -97,7 +97,7 @@ def test_transfer_erc721_without_nft_provide_info(cmd):
pass
assert error.args[0] == '0x6a80'
-
+
def test_transfer_erc721_without_set_plugin(cmd):
@@ -106,10 +106,10 @@ def test_transfer_erc721_without_set_plugin(cmd):
if cmd.model == "nanox" or cmd.model == "nanosp":
with pytest.raises(ethereum_client.exception.errors.DenyError) as error:
cmd.provide_nft_information(plugin=PROVIDE_NFT_INFORMATION)
-
+
cmd.send_apdu(SIGN_FIRST)
with cmd.send_apdu_context(SIGN_MORE, result) as ex:
pass
-
- assert error.args[0] == '0x6985'
\ No newline at end of file
+
+ assert error.args[0] == '0x6985'
diff --git a/tests/speculos/test_pubkey_cmd.py b/tests/speculos/test_pubkey_cmd.py
index 17f1d78..451bbf9 100644
--- a/tests/speculos/test_pubkey_cmd.py
+++ b/tests/speculos/test_pubkey_cmd.py
@@ -92,11 +92,11 @@ def test_reject_get_public_key(cmd):
# Approve
compare_screenshot(cmd, f"screenshots/pubkey/{PATH_IMG[cmd.model]}/reject_get_public_key/00004.png")
cmd.client.press_and_release('right')
-
+
# Reject
compare_screenshot(cmd, f"screenshots/pubkey/{PATH_IMG[cmd.model]}/reject_get_public_key/00005.png")
cmd.client.press_and_release('both')
-
+
if cmd.model == "nanox" or cmd.model == "nanosp":
# Verify address
compare_screenshot(cmd, f"screenshots/pubkey/{PATH_IMG[cmd.model]}/reject_get_public_key/00000.png")
diff --git a/tests/speculos/test_sign_cmd.py b/tests/speculos/test_sign_cmd.py
index 90879ac..5da7ef6 100644
--- a/tests/speculos/test_sign_cmd.py
+++ b/tests/speculos/test_sign_cmd.py
@@ -27,7 +27,7 @@ def test_sign_simple(cmd):
with cmd.simple_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Review transaction
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/simple/00000.png")
@@ -87,7 +87,7 @@ def test_sign_simple(cmd):
def test_sign_reject(cmd):
result: list = []
-
+
# Ether coin type
bip32_path="44'/60'/1'/0/0"
@@ -134,7 +134,7 @@ def test_sign_reject(cmd):
# Accept and send
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/reject/00008.png")
cmd.client.press_and_release('right')
-
+
# Reject
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/reject/00009.png")
cmd.client.press_and_release('both')
@@ -169,7 +169,7 @@ def test_sign_reject(cmd):
def test_sign_limit_nonce(cmd):
result: list = []
-
+
# Ether coin type
bip32_path="44'/60'/1'/0/0"
@@ -246,7 +246,7 @@ def test_sign_limit_nonce(cmd):
def test_sign_error_transaction_type(cmd):
result: list = []
-
+
# Ether coin type
bip32_path="44'/60'/1'/0/0"
@@ -311,7 +311,7 @@ def test_sign_nonce_display(cmd):
with cmd.simple_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Review transaction
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/nonce_display/00000.png")
@@ -413,7 +413,7 @@ def test_sign_blind_simple(cmd):
with cmd.simple_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Review transaction
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/blind_simple/00000.png")
@@ -546,7 +546,7 @@ def test_sign_blind_and_nonce_display(cmd):
with cmd.simple_sign_tx(bip32_path=bip32_path, transaction=transaction, result=result) as ex:
sleep(0.5)
-
+
if cmd.model == "nanos":
# Review transaction
compare_screenshot(cmd, f"screenshots/sign/{PATH_IMG[cmd.model]}/blind_and_nonce_display/00000.png")
diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore
index 2cbee4e..c77e954 100644
--- a/tests/unit/.gitignore
+++ b/tests/unit/.gitignore
@@ -19,4 +19,4 @@ build/
# Coverage file
coverage.info
-coverage
\ No newline at end of file
+coverage
diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt
index 93605b2..3683680 100644
--- a/tests/unit/CMakeLists.txt
+++ b/tests/unit/CMakeLists.txt
@@ -62,4 +62,4 @@ add_library(demo SHARED ./demo_tu.c)
target_link_libraries(test_demo PUBLIC cmocka gcov demo)
-add_test(test_demo test_demo)
\ No newline at end of file
+add_test(test_demo test_demo)
diff --git a/tests/unit/Makefile b/tests/unit/Makefile
index 71d8a14..91d1bfd 100644
--- a/tests/unit/Makefile
+++ b/tests/unit/Makefile
@@ -39,4 +39,4 @@ clean:
@if [ -d coverage ]; then $(ECHO) -e "${RED}[ RM ]${RESET}" coverage && $(RM) -r coverage ; fi;
@if [ -f coverage.info ]; then $(ECHO) -e "${RED}[ RM ]${RESET}" coverage.info && $(RM) -r coverage.info ; fi;
-.PHONY: all coverage clean
\ No newline at end of file
+.PHONY: all coverage clean
diff --git a/tests/unit/README.md b/tests/unit/README.md
index 68a98f2..bb2ab7f 100644
--- a/tests/unit/README.md
+++ b/tests/unit/README.md
@@ -1,7 +1,7 @@
# Unit tests
-It is important to unit test your functions.
-This also allows you to document how your functions work.
+It is important to unit test your functions.
+This also allows you to document how your functions work.
We use the library [**cmocka**](https://cmocka.org/#features)
## Requirement
@@ -9,11 +9,12 @@ We use the library [**cmocka**](https://cmocka.org/#features)
- [CMake >= 3.10](https://cmake.org/download/)
- [lcov >= 1.14](http://ltp.sourceforge.net/coverage/lcov.php)
-Don't worry, you don't necessarily need to install the `cmocka library` because the **cmakelist automatically fetches** the library
+Don't worry, you don't necessarily need to install the `cmocka library`
+because the **cmakelist automatically fetches** the library
## Add new test
-Create new file into `tests` folder and follow [this initiation](https://cmocka.org/talks/cmocka_unit_testing_and_mocking.pdf)
+Create new file into `tests` folder and follow [this initiation](https://cmocka.org/talks/cmocka_unit_testing_and_mocking.pdf)
Now go to the `CMakeLists.txt` file and add your test with the specific file you want to test.
@@ -27,12 +28,15 @@ The `default rules` of makefile will compile the tests and run them.
make
```
-The `coverage rule` will launch the default rules and generate the coverage and you will be **automatically redirected** to the generated .html
+The `coverage rule` will launch the default rules and generate the coverage
+and you will be **automatically redirected** to the generated .html
+
```sh
make coverage
```
The `clean rule` will delete the folders and files generated
+
```sh
make clean
-```
\ No newline at end of file
+```
diff --git a/tests/unit/demo_tu.c b/tests/unit/demo_tu.c
index c4f450c..1287e7c 100644
--- a/tests/unit/demo_tu.c
+++ b/tests/unit/demo_tu.c
@@ -9,4 +9,4 @@ int local_strchr_demo(char *string, char ch) {
}
}
return -1;
-}
\ No newline at end of file
+}
diff --git a/tests/unit/tests/demo.c b/tests/unit/tests/demo.c
index 1da227d..cdc9d9a 100644
--- a/tests/unit/tests/demo.c
+++ b/tests/unit/tests/demo.c
@@ -15,4 +15,4 @@ int main(void) {
cmocka_unit_test(null_test_success),
};
return cmocka_run_group_tests(tests, NULL, NULL);
-}
\ No newline at end of file
+}
diff --git a/tests/zemu/.gitignore b/tests/zemu/.gitignore
index 826d3f0..fedc352 100644
--- a/tests/zemu/.gitignore
+++ b/tests/zemu/.gitignore
@@ -1,4 +1,4 @@
/node_modules
/snapshots-tmp
/elfs
-/lib
\ No newline at end of file
+/lib
diff --git a/tests/zemu/Makefile b/tests/zemu/Makefile
index 82d7706..0ff9a84 100644
--- a/tests/zemu/Makefile
+++ b/tests/zemu/Makefile
@@ -5,4 +5,4 @@ all:
yarn install
yarn test
-.PHONY: all
\ No newline at end of file
+.PHONY: all
diff --git a/tests/zemu/globalsetup.js b/tests/zemu/globalsetup.js
index e835233..ce41bc6 100644
--- a/tests/zemu/globalsetup.js
+++ b/tests/zemu/globalsetup.js
@@ -14,4 +14,4 @@ module.exports = async () => {
await Zemu.checkAndPullImage();
await Zemu.stopAllEmuContainers();
fsExtra.emptyDirSync("snapshots/tmp")
-};
\ No newline at end of file
+};
diff --git a/tests/zemu/jest.config.js b/tests/zemu/jest.config.js
index af09403..63b6051 100644
--- a/tests/zemu/jest.config.js
+++ b/tests/zemu/jest.config.js
@@ -34,6 +34,6 @@ module.exports = {
// Path of the file where tests can be """decorated"""
setupFilesAfterEnv: ['/setupTests.js'],
- // Stop immediatly when a test fail
+ // Stop immediately when a test fail
bail: true,
};
diff --git a/tests/zemu/jest.js b/tests/zemu/jest.js
index 521ecbe..c5156ab 100644
--- a/tests/zemu/jest.js
+++ b/tests/zemu/jest.js
@@ -19,4 +19,4 @@ export const sim_options_x = {
export const Resolve = require("path").resolve;
export const NANOS_ELF_PATH = Resolve("elfs/ethereum_nanos.elf");
-export const NANOX_ELF_PATH = Resolve("elfs/ethereum_nanox.elf");
\ No newline at end of file
+export const NANOX_ELF_PATH = Resolve("elfs/ethereum_nanox.elf");
diff --git a/tests/zemu/setupTests.js b/tests/zemu/setupTests.js
index cbd0230..a9a9f82 100644
--- a/tests/zemu/setupTests.js
+++ b/tests/zemu/setupTests.js
@@ -16,4 +16,4 @@ expect.extend({
}
}
},
- });
\ No newline at end of file
+ });