Skip to content

Commit

Permalink
Misspelings
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeutin-ledger committed Oct 17, 2023
1 parent ea5f522 commit e0775cb
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 26 deletions.
1 change: 1 addition & 0 deletions .codespell_ignore_list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nin
29 changes: 29 additions & 0 deletions .github/workflows/misspellings_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Misspellings checks

# This workflow performs some misspelling checks on the repository
# It is there to help us maintain a level of quality in our codebase and does not have to be kept on forked
# applications.

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

jobs:
misspell:
name: Check misspellings
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3

- name: Check misspellings
uses: codespell-project/actions-codespell@v1
with:
builtin: clear,rare
check_filenames: true
path: src/,test/python/,protocol.md,Makefile,README.md
10 changes: 5 additions & 5 deletions protocol.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Protocol to speak with EXCHANGE application

Communication is done through a serie of request-response exchanges (APDU / RAPDU).
Communication is done through a series of request-response exchanges (APDU / RAPDU).


## Request:
Expand All @@ -19,7 +19,7 @@ Communication is done through a serie of request-response exchanges (APDU / RAPD

| Name | Value | Description |
| ---------------------------- | ----- | ------------------------------------------------------------------------------------- |
| GET_VERSION | 0x02 | Get application version. This APDU can be sent independantly of the current app state |
| GET_VERSION | 0x02 | Get application version. This APDU can be sent independently of the current app state |
| START_NEW_TRANSACTION | 0x03 | Start new EXCHANGE transaction. This APDU resets the app state |
| SET_PARTNER_KEY | 0x04 | Set the credentials of the exchange partner |
| CHECK_PARTNER | 0x05 | Check that the credentials of the exchange partner are signed by the Ledger key |
Expand Down Expand Up @@ -119,7 +119,7 @@ No data expected.
| N bytes | Partner name encoded with utf-8 |
| LC - (1 + N) bytes | Partner public key |

##### For all UNFIED TYPES, the data for this command is:
##### For all UNIFIED TYPES, the data for this command is:

| Bytes | Description |
| ------------------ | ------------------------------------ |
Expand Down Expand Up @@ -149,7 +149,7 @@ Please refer to the src/protobuf files for the actual transaction proposal conte
| 1 byte | Length M of the transaction fees |
| M bytes | Transaction fees |

##### For all UNFIED TYPES, the data for this command is:
##### For all UNIFIED TYPES, the data for this command is:

| Bytes | Description |
| ------- | -------------------------------------------- |
Expand Down Expand Up @@ -177,7 +177,7 @@ For SELL_LEGACY and FUND_LEGACY the signature is computed on the transaction pro
For SWAP_LEGACY and FUND_LEGACY, the signature is in DER format. \
For SELL_LEGACY the signature is in (R,S) format.

##### For all UNFIED TYPES, the data for this command is:
##### For all UNIFIED TYPES, the data for this command is:

| Bytes | Description |
| ------------ | ------------------------------------------------------------- |
Expand Down
6 changes: 3 additions & 3 deletions src/apdu_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ typedef struct apdu_s {
uint8_t rate;
uint8_t subcommand;
uint16_t data_length;
// We could have put the recontructed apdu buffer here but it would increase the RAM usage by
// We could have put the reconstructed apdu buffer here but it would increase the RAM usage by
// 512 bytes which is a lot on NANOS
// Instead the recontructed apdu buffer is G_swap_ctx.raw_transaction
// Instead the reconstructed apdu buffer is G_swap_ctx.raw_transaction
// It is unionized with the decoded protobuf transaction requests
// Pro: less memory usage
// Cons: use cautiously and only during the command PROCESS_TRANSACTION_RESPONSE_COMMAND
Expand Down Expand Up @@ -74,7 +74,7 @@ static uint16_t check_instruction(uint8_t instruction, uint8_t subcommand) {
case GET_VERSION_COMMAND:
// We ignore the current context for this command as it doesn't modify anything
check_subcommand_context = false;
// No strict dependancy on the current state as long as it is not a protected state
// No strict dependency on the current state as long as it is not a protected state
// (WAITING_USER_VALIDATION and WAITING_SIGNING)
check_current_state = -1;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// param[in] <in_size> the total size of the buffer to parse
// param[in] <size_of_length_field> the size of the length field in the header
// param[out] <out> the buf_t read from in_buffer at offset, can by 0 sized
// param[in/out] <offset> the current offset at wich we are in <in_buffer>
// param[in/out] <offset> the current offset at which we are in <in_buffer>
bool parse_to_sized_buffer(uint8_t *in_buffer,
uint16_t in_size,
uint8_t size_of_length_field,
Expand Down Expand Up @@ -55,7 +55,7 @@ bool parse_to_sized_buffer(uint8_t *in_buffer,
// param[in] <in_buffer> the total buffer to parse
// param[in] <in_size> the total size of the buffer to parse
// param[out] <out> the int read from in_buffer at offset
// param[in/out] <offset> the current offset at wich we are in <in_buffer>
// param[in/out] <offset> the current offset at which we are in <in_buffer>
bool pop_uint8_from_buffer(uint8_t *in_buffer, uint16_t in_size, uint8_t *out, uint16_t *offset) {
if (*offset + 1 > in_size) {
PRINTF("Failed to read the uint, only %d bytes available\n", in_size);
Expand Down
2 changes: 1 addition & 1 deletion src/check_tx_signature.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int check_tx_signature(const command_t *cmd) {

uint16_t payload_size = remaining_input.bytes[DER_OFFSET_LENGTH];
if (payload_size + DER_HEADER_SIZE != remaining_input.size) {
PRINTF("DER signature header advertizes %d bytes, we received %d\n",
PRINTF("DER signature header advertises %d bytes, we received %d\n",
payload_size,
remaining_input.size);
return reply_error(INCORRECT_COMMAND_DATA);
Expand Down
2 changes: 1 addition & 1 deletion src/parse_check_address_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static bool parse_der_signature(uint8_t *in, uint16_t in_size, buf_t *der, uint1
// 1 byte 0x30 1 + X
// 1 byte length C of compound object 2 + X
// C bytes
// 1 byte length Y of address paramaters 1 + X + D
// 1 byte length Y of address parameters 1 + X + D
// Y bytes of address parameters 2 + X + D
int parse_check_address_message(const command_t *cmd,
buf_t *config,
Expand Down
2 changes: 1 addition & 1 deletion src/parse_coin_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const app_name_alias_t appnames_aliases[] = {
* - A the application name, La its size
* - C the sub configuration, Lc its size
*
* As the sub configuration is optionnal, we accept Lc == 0
* As the sub configuration is optional, we accept Lc == 0
*/
bool parse_coin_config(buf_t input,
buf_t *ticker,
Expand Down
2 changes: 1 addition & 1 deletion src/process_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static void normalize_currencies(subcommand) {
}
}

// triming leading 0s
// trim leading 0s
static void trim_amounts(subcommand) {
if (subcommand == SWAP || subcommand == SWAP_NG) {
trim_pb_bytes_array(
Expand Down
8 changes: 4 additions & 4 deletions src/ui/validate_transaction_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ static char refusal_text[REFUSAL_TEXT_MAX_SIZE];
#define REVIEW_P1_TITLE "Review transaction"
#define REVIEW_P1_CONFIRM "Sign transaction"

// Delimitor ' ' or '\n'
// Delimiter ' ' or '\n'

#define REVIEW_P2 "to"

// Delimitor ' ' or '\n'
// Delimiter ' ' or '\n'

// One of:
#define REVIEW_P3_SWAP "swap "
#define REVIEW_P3_SELL "sell "
#define REVIEW_P3_FUND "fund account"

// Delimitor ' ' or '\n'
// Delimiter ' ' or '\n'

// One of:
#define REVIEW_P4_SWAP "to "
Expand Down Expand Up @@ -187,7 +187,7 @@ void ui_validate_amounts(void) {
break;
}

// Detect if we shoud display on 2 or 3 lines.
// Detect if we should display on 2 or 3 lines.
if ((G_swap_ctx.subcommand == FUND || G_swap_ctx.subcommand == FUND_NG) ||
(strlen(dyn_string_1) + strlen(dyn_string_2) >= 10)) {
PRINTF("Review title and confirm on 3 lines\n");
Expand Down
2 changes: 1 addition & 1 deletion test/python/apps/exchange_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ExchangeTestRunner:
# fake_payout_memo: str
# signature_refusal_error_code: int

# You can optionnaly overwrite the following default values if you want
# You can optionally overwrite the following default values if you want
partner_name = "Default name"
fund_user_id = "Jon Wick"
fund_account_name = "My account 00"
Expand Down
6 changes: 3 additions & 3 deletions test/python/apps/signing_authority.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ def __init__(self, curve: ec.EllipticCurve, name: str, existing_key: Optional[in
@property
def credentials(self) -> bytes:
"""
:return: The partner credentials correctly formated for legacy flows
:return: The partner credentials correctly formatted for legacy flows
:rtype: bytes
"""
return self._credentials

@property
def credentials_ng(self) -> bytes:
"""
:return: The partner credentials correctly formated for ng flows
:return: The partner credentials correctly formatted for ng flows
:rtype: bytes
"""
return self._credentials_ng
Expand All @@ -73,7 +73,7 @@ def sign(self, payload_to_sign: bytes) -> bytes:
"""
Sign the requested data
:param payload_to_sign: The payload the parnter needs to sign
:param payload_to_sign: The payload the partner needs to sign
:type payload_to_sign: bytes
:return: The payload signed
Expand Down
2 changes: 1 addition & 1 deletion test/python/apps/tezos.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def blake2_hash_pubkey(pubkey: bytes) -> bytes:
return blake2b(pubkey, digest_size=HASH_SIZE).digest()


# Weird Tezos formating used for values:
# Weird Tezos formatting used for values:
# Values are packed on the 7 week bits of each byte
# The strongest bit is set to true if the value is over
# Example with format(300):
Expand Down
4 changes: 2 additions & 2 deletions test/python/test_fund_flow_ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_fund_flow_ethereum_max_partner_name_length(backend, exchange_navigation
eth = EthereumClient(backend)
assert eth.get_public_key().status == 0x9000
# The original bug was that the Ethereum app was returning just after
# launch, and the first Ethereum:get_public_key call was in fact catched
# launch, and the first Ethereum:get_public_key call was in fact caught
# by the Exchange app and interpreted as an Exchange::get_version call.
# Exchange version are on 3 bytes, so we check the call does not return
# 3 bytes of data
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_fund_flow_ethereum_min_partner_name_length(backend, exchange_navigation
eth = EthereumClient(backend)
assert eth.get_public_key().status == 0x9000
# The original bug was that the Ethereum app was returning just after
# launch, and the first Ethereum:get_public_key call was in fact catched
# launch, and the first Ethereum:get_public_key call was in fact caught
# by the Exchange app and interpreted as an Exchange::get_version call.
# Exchange version are on 3 bytes, so we check the call does not return
# 3 bytes of data
Expand Down
2 changes: 1 addition & 1 deletion test/python/test_sell_flow_ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_sell_flow(backend, exchange_navigation_helper):
eth = EthereumClient(backend)
assert eth.get_public_key().status == 0x9000
# The original bug was that the Ethereum app was returning just after
# launch, and the first Ethereum:get_public_key call was in fact catched
# launch, and the first Ethereum:get_public_key call was in fact caught
# by the Exchange app and interpreted as an Exchange::get_version call.
# Exchange version are on 3 bytes, so we check the call does not return
# 3 bytes of data
Expand Down

0 comments on commit e0775cb

Please sign in to comment.