Fix compilation warnings (#159)

* Fix easy warnings for sdk 2.0

* Add attribute unused to bagl_elemt_t in callback functions

* Add attribute unused to io_event function

* Clang-format

* Use elfs from CI in tests (#167)

* Add Nano X build

* Use CI's build artifacts for CI's tests

* Add network display (#152)

* Add network name display instead of chainID

* Add display of correct ticker along with network

* Add FTM

* Clang-format

* Add comment in python script

* Rename SIZE_MAX to MAX_SIZE

* Change %u to %d in printf

* Remove needless PIC

* Update comment about get_chain_id()

* Update example script to follow EIP155

* Remove unused PIC calls

* Add whitespace between ticker and amount when using EIP155

* Remove decimal config per network, set back 18 everywhere

* Adapt u32_from_BE to swith cases

* Remove chainid from signTx.py

* Switch to switch in stead of if in get_chain_id

* Revert "Remove chainid from signTx.py"

This reverts commit 454e09f280ec3e3ec1c7d7cc0027247ef4390088.

* Change Ethereum chainid to 1

* Rename chainid_step to network_step

* Adapt finalizeParsing to new chainid for Ethereum

* Update snapshots

* clang-format

* Fix network display logic for clones

* Fix tests

* Add clone tests

Co-authored-by: TamtamHero <10632523+TamtamHero@users.noreply.github.com>

Co-authored-by: Jean P <10632523+TamtamHero@users.noreply.github.com>
This commit is contained in:
pscott
2021-07-05 11:01:51 +02:00
committed by GitHub
parent a2d9a8068a
commit b646cf1b28
27 changed files with 74 additions and 114 deletions

View File

@@ -4,7 +4,7 @@
#include "feature_getEth2PublicKey.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_eth2_address_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_eth2_address_ok(__attribute__((unused)) const bagl_element_t *e) {
uint32_t tx = set_result_get_eth2_publicKey();
G_io_apdu_buffer[tx++] = 0x90;
G_io_apdu_buffer[tx++] = 0x00;

View File

@@ -2,7 +2,7 @@
#include "feature_getPublicKey.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_address_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_address_ok(__attribute__((unused)) const bagl_element_t *e) {
uint32_t tx = set_result_get_publicKey();
G_io_apdu_buffer[tx++] = 0x90;
G_io_apdu_buffer[tx++] = 0x00;
@@ -14,7 +14,7 @@ unsigned int io_seproxyhal_touch_address_ok(const bagl_element_t *e) {
return 0; // do not redraw the widget
}
unsigned int io_seproxyhal_touch_address_cancel(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_address_cancel(__attribute__((unused)) const bagl_element_t *e) {
G_io_apdu_buffer[0] = 0x69;
G_io_apdu_buffer[1] = 0x85;
reset_app_context();

View File

@@ -102,7 +102,7 @@ void handleProvideErc20TokenInformation(uint8_t p1,
uint8_t *workBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
__attribute__((unused)) unsigned int *tx) {
UNUSED(p1);
UNUSED(p2);
UNUSED(flags);

View File

@@ -7,8 +7,8 @@ void handleSetEth2WithdrawalIndex(uint8_t p1,
uint8_t p2,
uint8_t *dataBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
__attribute__((unused)) unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
if (dataLength != 4) {
THROW(0x6700);
}

View File

@@ -65,8 +65,8 @@ void handleSetExternalPlugin(uint8_t p1,
CATCH_OTHER(e) {
PRINTF("%s external plugin is not present\n", dataContext.tokenContext.pluginName);
memset(dataContext.tokenContext.pluginName,
sizeof(dataContext.tokenContext.pluginName),
0);
0,
sizeof(dataContext.tokenContext.pluginName));
THROW(0x6984);
}
FINALLY {

View File

@@ -3,7 +3,7 @@
#include "utils.h"
#include "ui_flow.h"
static const char const SIGN_MAGIC[] =
static const char SIGN_MAGIC[] =
"\x19"
"Ethereum Signed Message:\n";

View File

@@ -1,7 +1,7 @@
#include "shared_context.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_signMessage_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_signMessage_ok(__attribute__((unused)) const bagl_element_t *e) {
uint8_t privateKeyData[INT256_LENGTH];
uint8_t signature[100];
uint8_t signatureLength;
@@ -46,7 +46,8 @@ unsigned int io_seproxyhal_touch_signMessage_ok(const bagl_element_t *e) {
return 0; // do not redraw the widget
}
unsigned int io_seproxyhal_touch_signMessage_cancel(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_signMessage_cancel(__attribute__((unused))
const bagl_element_t *e) {
reset_app_context();
G_io_apdu_buffer[0] = 0x69;
G_io_apdu_buffer[1] = 0x85;

View File

@@ -1,9 +1,10 @@
#include "shared_context.h"
#include "ui_callbacks.h"
static const uint8_t const EIP_712_MAGIC[] = {0x19, 0x01};
static const uint8_t EIP_712_MAGIC[] = {0x19, 0x01};
unsigned int io_seproxyhal_touch_signMessage712_v0_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_signMessage712_v0_ok(__attribute__((unused))
const bagl_element_t *e) {
uint8_t privateKeyData[INT256_LENGTH];
uint8_t hash[INT256_LENGTH];
uint8_t signature[100];
@@ -70,7 +71,8 @@ unsigned int io_seproxyhal_touch_signMessage712_v0_ok(const bagl_element_t *e) {
return 0; // do not redraw the widget
}
unsigned int io_seproxyhal_touch_signMessage712_v0_cancel(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_signMessage712_v0_cancel(__attribute__((unused))
const bagl_element_t *e) {
reset_app_context();
G_io_apdu_buffer[0] = 0x69;
G_io_apdu_buffer[1] = 0x85;

View File

@@ -2,5 +2,4 @@
customStatus_e customProcessor(txContext_t *context);
void finalizeParsing(bool direct);
void ux_approve_tx(bool dataPresent);

View File

@@ -2,6 +2,7 @@
#include "utils.h"
#include "ui_callbacks.h"
#include "ui_flow.h"
#include "feature_signTx.h"
#ifdef HAVE_STARKWARE
#include "stark_utils.h"
#endif

View File

@@ -2,7 +2,7 @@
#include "utils.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_tx_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_tx_ok(__attribute__((unused)) const bagl_element_t *e) {
uint8_t privateKeyData[INT256_LENGTH];
uint8_t signature[100];
uint8_t signatureLength;
@@ -58,7 +58,7 @@ unsigned int io_seproxyhal_touch_tx_ok(const bagl_element_t *e) {
return 0; // do not redraw the widget
}
unsigned int io_seproxyhal_touch_tx_cancel(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_tx_cancel(__attribute__((unused)) const bagl_element_t *e) {
reset_app_context();
G_io_apdu_buffer[0] = 0x69;
G_io_apdu_buffer[1] = 0x85;
@@ -69,7 +69,7 @@ unsigned int io_seproxyhal_touch_tx_cancel(const bagl_element_t *e) {
return 0; // do not redraw the widget
}
unsigned int io_seproxyhal_touch_data_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_data_ok(__attribute__((unused)) const bagl_element_t *e) {
parserStatus_e txResult = USTREAM_FINISHED;
txResult = continueTx(&txContext);
switch (txResult) {
@@ -100,7 +100,7 @@ unsigned int io_seproxyhal_touch_data_ok(const bagl_element_t *e) {
return 0;
}
unsigned int io_seproxyhal_touch_data_cancel(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_data_cancel(__attribute__((unused)) const bagl_element_t *e) {
reset_app_context();
io_seproxyhal_send_status(0x6985);
// Display back the original UX

View File

@@ -4,7 +4,7 @@
#include "ui_callbacks.h"
#include "feature_stark_getPublicKey.h"
unsigned int io_seproxyhal_touch_stark_pubkey_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_stark_pubkey_ok(__attribute__((unused)) const bagl_element_t *e) {
uint32_t tx = set_result_get_stark_publicKey();
G_io_apdu_buffer[tx++] = 0x90;
G_io_apdu_buffer[tx++] = 0x00;

View File

@@ -5,11 +5,11 @@
#include "ui_flow.h"
void handleStarkwareProvideQuantum(uint8_t p1,
uint8_t p2,
__attribute__((unused)) uint8_t p2,
uint8_t *dataBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
__attribute__((unused)) unsigned int *flags,
__attribute__((unused)) unsigned int *tx) {
size_t i = 0;
uint8_t expectedDataSize = 20 + 32;
uint8_t addressZero = 0;

View File

@@ -16,7 +16,7 @@ void handleStarkwareSignMessage(uint8_t p1,
uint8_t *dataBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
__attribute__((unused)) unsigned int *tx) {
uint8_t privateKeyData[INT256_LENGTH];
uint32_t i;
uint8_t bip32PathLength = *(dataBuffer);

View File

@@ -4,7 +4,7 @@
#include "stark_utils.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_stark_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_stark_ok(__attribute__((unused)) const bagl_element_t *e) {
uint8_t privateKeyData[32];
uint8_t signature[72];
uint32_t tx = 0;

View File

@@ -11,7 +11,7 @@ void handleStarkwareUnsafeSign(uint8_t p1,
uint8_t *dataBuffer,
uint16_t dataLength,
unsigned int *flags,
unsigned int *tx) {
__attribute__((unused)) unsigned int *tx) {
uint32_t i;
uint8_t privateKeyData[INT256_LENGTH];
cx_ecfp_public_key_t publicKey;

View File

@@ -4,7 +4,8 @@
#include "stark_utils.h"
#include "ui_callbacks.h"
unsigned int io_seproxyhal_touch_stark_unsafe_sign_ok(const bagl_element_t *e) {
unsigned int io_seproxyhal_touch_stark_unsafe_sign_ok(__attribute__((unused))
const bagl_element_t *e) {
cx_ecfp_private_key_t privateKey;
uint8_t privateKeyData[INT256_LENGTH];
uint8_t signature[72];