diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad5dd6..ed66f06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [1.9.1](https://github.com/ledgerhq/app-ethereum/compare/1.8.8...1.9.1) - 2021-8-06 +## [1.9.1](https://github.com/ledgerhq/app-ethereum/compare/1.9.0...1.9.1) - 2021-8-11 ### Added -- Fix BSC app icons. -- Fix tokens for Theta app. +- Added support for bigger chainIDs. + +### Fixed + +- Fixed BSC icon colors. +- Fixed theta tokens. +- Fix BSC app name display. ## [1.9.0](https://github.com/ledgerhq/app-ethereum/compare/1.8.8...1.9.0) - 2021-8-05 diff --git a/Makefile b/Makefile index 61842ef..3d127f0 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=1 +APPVERSION_P=2 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) @@ -210,7 +210,7 @@ APPNAME = "Theta" else ifeq ($(CHAIN),bsc) APP_LOAD_PARAMS += --path "44'/60'" DEFINES += CHAINID_UPCASE=\"BSC\" CHAINID_COINNAME=\"BNB\" CHAIN_KIND=CHAIN_KIND_BSC CHAIN_ID=56 -APPNAME = "Binance Smart Chain" +APPNAME = "BSC" else ifeq ($(filter clean,$(MAKECMDGOALS)),) $(error Unsupported CHAIN - use ethereum, ropsten, ethereum_classic, expanse, poa, artis_sigma1, artis_tau1, rsk, rsk_testnet, ubiq, wanchain, kusd, musicoin, pirl, akroma, atheios, callisto, ethersocial, ellaism, ether1, ethergem, gochain, mix, reosc, hpb, tomochain, tobalaba, dexon, volta, ewc, webchain, thundercore, flare, flare_coston, theta) diff --git a/src/utils.c b/src/utils.c index 85f2add..e3e04c6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -54,9 +54,7 @@ int local_strchr(char *string, char ch) { return -1; } -// Almost like U4BE except that it takes `size` as a parameter. -// The `strict` parameter defines whether we should throw in case of a length > 4. -uint32_t u32_from_BE(uint8_t *in, uint8_t size, bool strict) { +uint32_t u32_from_BE(uint8_t *in, uint8_t size) { switch (size) { case 0: return 0; @@ -66,13 +64,7 @@ uint32_t u32_from_BE(uint8_t *in, uint8_t size, bool strict) { return (in[0] << 8) | in[1]; case 3: return (in[0] << 16) | (in[1] << 8) | in[2]; - case 4: - return (in[0] << 24) | (in[1] << 16) | (in[2] << 8) | in[3]; default: - if (strict) { - PRINTF("Unexpected format\n"); - THROW(EXCEPTION); - } return (in[0] << 24) | (in[1] << 16) | (in[2] << 8) | in[3]; } } diff --git a/src/utils.h b/src/utils.h index 17a59b5..f10ac19 100644 --- a/src/utils.h +++ b/src/utils.h @@ -28,9 +28,7 @@ void convertUint256BE(uint8_t* data, uint32_t length, uint256_t* target); int local_strchr(char* string, char ch); -// Converts a list of bytes (in BE) of length `size` to a uint32_t. `strict` will make the function -// throw if the size is > 4. -uint32_t u32_from_BE(uint8_t* in, uint8_t size, bool strict); +uint32_t u32_from_BE(uint8_t* in, uint8_t size); bool uint256_to_decimal(const uint8_t* value, size_t value_len, char* out, size_t out_len); diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index fc091cc..a706e6e 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -24,7 +24,6 @@ #define MAX_INT256 32 #define MAX_ADDRESS 20 -#define MAX_V 4 void initTx(txContext_t *context, cx_sha3_t *sha3, @@ -295,13 +294,11 @@ static void processV(txContext_t *context) { PRINTF("Invalid type for RLP_V\n"); THROW(EXCEPTION); } - if (context->currentFieldLength > MAX_V) { - PRINTF("Invalid length for RLP_V\n"); - THROW(EXCEPTION); - } if (context->currentFieldPos < context->currentFieldLength) { uint32_t copySize = MIN(context->commandLength, context->currentFieldLength - context->currentFieldPos); + // Make sure we do not copy more than the size of v. + copySize = MIN(copySize, sizeof(context->content->v)); copyTxData(context, context->content->v + context->currentFieldPos, copySize); } if (context->currentFieldPos == context->currentFieldLength) { diff --git a/src_common/network.c b/src_common/network.c index 5f33b8a..f1181b8 100644 --- a/src_common/network.c +++ b/src_common/network.c @@ -26,13 +26,12 @@ uint32_t get_chain_id(void) { switch (txContext.txType) { case LEGACY: - chain_id = u32_from_BE(txContext.content->v, txContext.content->vLength, true); + chain_id = u32_from_BE(txContext.content->v, txContext.content->vLength); break; case EIP2930: case EIP1559: chain_id = u32_from_BE(tmpContent.txContent.chainID.value, - tmpContent.txContent.chainID.length, - true); + tmpContent.txContent.chainID.length); break; default: PRINTF("Txtype `%d` not supported while generating chainID\n", txContext.txType); diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index a7cb59e..47960af 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -257,22 +257,6 @@ void prepareFeeDisplay() { sizeof(strings.common.maxFee)); } -uint32_t get_chainID() { - uint32_t chain_id = 0; - - if (txContext.txType == LEGACY) { - chain_id = u32_from_BE(txContext.content->v, txContext.content->vLength, true); - } else if (txContext.txType == EIP2930 || txContext.txType == EIP1559) { - chain_id = u32_from_BE(tmpContent.txContent.chainID.value, - tmpContent.txContent.chainID.length, - true); - } else { - PRINTF("Txtype `%u` not supported while generating chainID\n", txContext.txType); - } - PRINTF("ChainID: %d\n", chain_id); - return chain_id; -} - void prepareNetworkDisplay() { char *name = get_network_name(); if (name == NULL) { diff --git a/src_features/signTx/ui_common_signTx.c b/src_features/signTx/ui_common_signTx.c index eb2ee11..360f883 100644 --- a/src_features/signTx/ui_common_signTx.c +++ b/src_features/signTx/ui_common_signTx.c @@ -7,7 +7,7 @@ unsigned int io_seproxyhal_touch_tx_ok(__attribute__((unused)) const bagl_elemen uint8_t signature[100]; cx_ecfp_private_key_t privateKey; uint32_t tx = 0; - uint32_t v = u32_from_BE(tmpContent.txContent.v, tmpContent.txContent.vLength, true); + uint32_t v = u32_from_BE(tmpContent.txContent.v, tmpContent.txContent.vLength); io_seproxyhal_io_heartbeat(); os_perso_derive_node_bip32(CX_CURVE_256K1, tmpCtx.transactionContext.bip32Path,