From 551327f0846614bb100566add7cf7246d5eca55c Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Thu, 25 Jul 2024 14:04:54 +0200 Subject: [PATCH 1/5] Version bump to 1.12.0-dev --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a0bc4e1..532441b 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,9 @@ endif include ./makefile_conf/chain/$(CHAIN).mk APPVERSION_M = 1 -APPVERSION_N = 11 +APPVERSION_N = 12 APPVERSION_P = 0 -APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) +APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev # Application source files APP_SOURCE_PATH += src src_features src_plugins From 44b5a23785893f54ce30f37ec5685d48e9699f29 Mon Sep 17 00:00:00 2001 From: apaillier-ledger <94451027+apaillier-ledger@users.noreply.github.com> Date: Fri, 26 Jul 2024 10:46:52 +0200 Subject: [PATCH 2/5] Fix Wanchain (#615) * fix Wanchain app sign error * remove redundant path --------- Co-authored-by: zhwir --- src/ethUstream.c | 48 +------------------------------- src/ethUstream.h | 11 +------- src/network.c | 1 + src_features/signTx/cmd_signTx.c | 5 +--- 4 files changed, 4 insertions(+), 61 deletions(-) diff --git a/src/ethUstream.c b/src/ethUstream.c index 3737dc2..428adb5 100644 --- a/src/ethUstream.c +++ b/src/ethUstream.c @@ -103,26 +103,6 @@ static void processAccessList(txContext_t *context) { } } -static void processType(txContext_t *context) { - if (context->currentFieldIsList) { - PRINTF("Invalid type for RLP_TYPE\n"); - THROW(EXCEPTION); - } - if (context->currentFieldLength > MAX_INT256) { - PRINTF("Invalid length for RLP_TYPE\n"); - THROW(EXCEPTION); - } - if (context->currentFieldPos < context->currentFieldLength) { - uint32_t copySize = - MIN(context->commandLength, context->currentFieldLength - context->currentFieldPos); - copyTxData(context, NULL, copySize); - } - if (context->currentFieldPos == context->currentFieldLength) { - context->currentField++; - context->processingField = false; - } -} - static void processChainID(txContext_t *context) { if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_CHAINID\n"); @@ -321,14 +301,6 @@ static bool processEIP1559Tx(txContext_t *context) { switch (context->currentField) { case EIP1559_RLP_CONTENT: { processContent(context); - if ((context->processingFlags & TX_FLAG_TYPE) == 0) { - context->currentField++; - } - break; - } - // This gets hit only by Wanchain - case EIP1559_RLP_TYPE: { - processType(context); break; } case EIP1559_RLP_CHAINID: { @@ -377,13 +349,6 @@ static bool processEIP2930Tx(txContext_t *context) { switch (context->currentField) { case EIP2930_RLP_CONTENT: processContent(context); - if ((context->processingFlags & TX_FLAG_TYPE) == 0) { - context->currentField++; - } - break; - // This gets hit only by Wanchain - case EIP2930_RLP_TYPE: - processType(context); break; case EIP2930_RLP_CHAINID: processChainID(context); @@ -420,13 +385,6 @@ static bool processLegacyTx(txContext_t *context) { switch (context->currentField) { case LEGACY_RLP_CONTENT: processContent(context); - if ((context->processingFlags & TX_FLAG_TYPE) == 0) { - context->currentField++; - } - break; - // This gets hit only by Wanchain - case LEGACY_RLP_TYPE: - processType(context); break; case LEGACY_RLP_NONCE: processNonce(context); @@ -592,16 +550,12 @@ static parserStatus_e processTxInternal(txContext_t *context) { PRINTF("end of here\n"); } -parserStatus_e processTx(txContext_t *context, - const uint8_t *buffer, - uint32_t length, - uint32_t processingFlags) { +parserStatus_e processTx(txContext_t *context, const uint8_t *buffer, uint32_t length) { parserStatus_e result; BEGIN_TRY { TRY { context->workBuffer = buffer; context->commandLength = length; - context->processingFlags = processingFlags; result = processTxInternal(context); PRINTF("result: %d\n", result); } diff --git a/src/ethUstream.h b/src/ethUstream.h index d14a42a..b27e490 100644 --- a/src/ethUstream.h +++ b/src/ethUstream.h @@ -36,8 +36,6 @@ typedef enum customStatus_e { typedef customStatus_e (*ustreamProcess_t)(struct txContext_t *context); -#define TX_FLAG_TYPE 0x01 - // First variant of every Tx enum. #define RLP_NONE 0 @@ -49,7 +47,6 @@ typedef customStatus_e (*ustreamProcess_t)(struct txContext_t *context); typedef enum rlpLegacyTxField_e { LEGACY_RLP_NONE = RLP_NONE, LEGACY_RLP_CONTENT, - LEGACY_RLP_TYPE, // For wanchain LEGACY_RLP_NONCE, LEGACY_RLP_GASPRICE, LEGACY_RLP_STARTGAS, @@ -65,7 +62,6 @@ typedef enum rlpLegacyTxField_e { typedef enum rlpEIP2930TxField_e { EIP2930_RLP_NONE = RLP_NONE, EIP2930_RLP_CONTENT, - EIP2930_RLP_TYPE, // For wanchain EIP2930_RLP_CHAINID, EIP2930_RLP_NONCE, EIP2930_RLP_GASPRICE, @@ -80,7 +76,6 @@ typedef enum rlpEIP2930TxField_e { typedef enum rlpEIP1559TxField_e { EIP1559_RLP_NONE = RLP_NONE, EIP1559_RLP_CONTENT, - EIP1559_RLP_TYPE, // For wanchain EIP1559_RLP_CHAINID, EIP1559_RLP_NONCE, EIP1559_RLP_MAX_PRIORITY_FEE_PER_GAS, @@ -125,7 +120,6 @@ typedef struct txContext_t { uint32_t rlpBufferPos; const uint8_t *workBuffer; uint32_t commandLength; - uint32_t processingFlags; ustreamProcess_t customProcessor; txContent_t *content; void *extra; @@ -137,10 +131,7 @@ void initTx(txContext_t *context, txContent_t *content, ustreamProcess_t customProcessor, void *extra); -parserStatus_e processTx(txContext_t *context, - const uint8_t *buffer, - uint32_t length, - uint32_t processingFlags); +parserStatus_e processTx(txContext_t *context, const uint8_t *buffer, uint32_t length); parserStatus_e continueTx(txContext_t *context); void copyTxData(txContext_t *context, uint8_t *out, uint32_t length); uint8_t readTxByte(txContext_t *context); diff --git a/src/network.c b/src/network.c index 608ceb4..660e58e 100644 --- a/src/network.c +++ b/src/network.c @@ -51,6 +51,7 @@ static const network_info_t NETWORK_MAPPING[] = { {.chain_id = 336, .name = "Shiden", .ticker = "SDN"}, {.chain_id = 369, .name = "PulseChain", .ticker = "PLS"}, {.chain_id = 592, .name = "Astar", .ticker = "ASTR"}, + {.chain_id = 888, .name = "Wanchain", .ticker = "WAN"}, {.chain_id = 1030, .name = "Conflux", .ticker = "CFX"}, {.chain_id = 1088, .name = "Metis Andromeda", .ticker = "METIS"}, {.chain_id = 1101, .name = "Polygon zkEVM", .ticker = "ETH"}, diff --git a/src_features/signTx/cmd_signTx.c b/src_features/signTx/cmd_signTx.c index 4da3a76..99ac51f 100644 --- a/src_features/signTx/cmd_signTx.c +++ b/src_features/signTx/cmd_signTx.c @@ -69,10 +69,7 @@ void handleSign(uint8_t p1, PRINTF("Parser not initialized\n"); THROW(0x6985); } - txResult = processTx(&txContext, - workBuffer, - dataLength, - (chainConfig->chainId == 888 ? TX_FLAG_TYPE : 0)); // Wanchain exception + txResult = processTx(&txContext, workBuffer, dataLength); switch (txResult) { case USTREAM_SUSPENDED: break; From 617291db6de2d49f0e35f74d5926e86a7a1962dd Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 26 Jul 2024 14:18:14 +0200 Subject: [PATCH 3/5] Fix uninitialized UI buffer for EIP-712 Would refuse the message altogether if strings.tmp.tmp wasn't empty. Introduced in 4680a9d583393a50b49efa4992f31b2c117ad803 --- src_features/signMessageEIP712/ui_logic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_features/signMessageEIP712/ui_logic.c b/src_features/signMessageEIP712/ui_logic.c index 357cca5..5d698b1 100644 --- a/src_features/signMessageEIP712/ui_logic.c +++ b/src_features/signMessageEIP712/ui_logic.c @@ -177,8 +177,7 @@ e_eip712_nfs ui_712_next_field(void) { handle_eip712_return_code(true); state = EIP712_FIELD_INCOMING; // So that later when we append to them, we start from an empty string - explicit_bzero(strings.tmp.tmp, sizeof(strings.tmp.tmp)); - explicit_bzero(strings.tmp.tmp2, sizeof(strings.tmp.tmp2)); + explicit_bzero(&strings, sizeof(strings)); } } return state; @@ -622,6 +621,7 @@ bool ui_712_init(void) { if ((ui_ctx = MEM_ALLOC_AND_ALIGN_TYPE(*ui_ctx))) { explicit_bzero(ui_ctx, sizeof(*ui_ctx)); ui_ctx->filtering_mode = EIP712_FILTERING_BASIC; + explicit_bzero(&strings, sizeof(strings)); } else { apdu_response_code = APDU_RESPONSE_INSUFFICIENT_MEMORY; } From aa2d12dba7a8f1d427c8167765fab0d92f00d128 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 26 Jul 2024 14:36:57 +0200 Subject: [PATCH 4/5] Changed version number to 1.11.1 --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 532441b..53a94a7 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,9 @@ endif include ./makefile_conf/chain/$(CHAIN).mk APPVERSION_M = 1 -APPVERSION_N = 12 -APPVERSION_P = 0 -APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-dev +APPVERSION_N = 11 +APPVERSION_P = 1 +APPVERSION = $(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) # Application source files APP_SOURCE_PATH += src src_features src_plugins From b7efb4d4ad9b6936342ef8a2b322ad0c0421b8ab Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 26 Jul 2024 14:37:17 +0200 Subject: [PATCH 5/5] Updated changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9866b0..52ee374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ 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.11.1](https://github.com/ledgerhq/app-ethereum/compare/1.11.0...1.11.1) - 2024-07-26 + +### Fixed + +- (network/clone) Wanchain +- Refusal of EIP-712 messages after another transaction or message + ## [1.11.0](https://github.com/ledgerhq/app-ethereum/compare/1.10.4...1.11.0) - 2024-07-24 ### Added