From 3eeec97efa98fa68974242fdf8f07366109c812b Mon Sep 17 00:00:00 2001 From: Jean P <10632523+TamtamHero@users.noreply.github.com> Date: Thu, 28 Oct 2021 18:10:21 +0200 Subject: [PATCH] Share network ticker with plugins (#205) * Add network ticker to queryContractUI for plugins use * Update sdk deps * Bump version 1.9.11 * Fix blockSize error when bytes is optimized by EVM Co-authored-by: pscott --- CHANGELOG.md | 6 ++++++ Makefile | 2 +- ethereum-plugin-sdk | 2 +- src/eth_plugin_handler.c | 3 +++ src/eth_plugin_interface.h | 5 ++++- src_features/signTx/logic_signTx.c | 6 +++--- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2250a2..5f6c0e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ 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.11](https://github.com/ledgerhq/app-ethereum/compare/1.9.10...1.9.11) - 2021-10-12 + +### Added + +- Provide network ticker to plugins (especialy helpful for Paraswap plugin) + ## [1.9.10](https://github.com/ledgerhq/app-ethereum/compare/1.9.9...1.9.10) - 2021-10-08 ### Added diff --git a/Makefile b/Makefile index 184ba47..7c4e149 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=10 +APPVERSION_P=11 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index 116ca51..f9a7d87 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit 116ca51519756ab1b0dfaecf2affabeee35ba6b4 +Subproject commit f9a7d87d729b37190912ce1962c9b20e60bd9adb diff --git a/src/eth_plugin_handler.c b/src/eth_plugin_handler.c index d20e927..dac067a 100644 --- a/src/eth_plugin_handler.c +++ b/src/eth_plugin_handler.c @@ -45,6 +45,9 @@ void eth_plugin_prepare_query_contract_UI(ethQueryContractUI_t *queryContractUI, uint32_t msgLength) { memset((uint8_t *) queryContractUI, 0, sizeof(ethQueryContractUI_t)); queryContractUI->screenIndex = screenIndex; + strlcpy(queryContractUI->network_ticker, + get_network_ticker(), + sizeof(queryContractUI->network_ticker)); queryContractUI->title = title; queryContractUI->titleLength = titleLength; queryContractUI->msg = msg; diff --git a/src/eth_plugin_interface.h b/src/eth_plugin_interface.h index 94d7b7e..1887154 100644 --- a/src/eth_plugin_interface.h +++ b/src/eth_plugin_interface.h @@ -12,7 +12,8 @@ // Interface version. To be updated everytime we introduce breaking changes to the plugin interface. typedef enum { ETH_PLUGIN_INTERFACE_VERSION_1 = 1, // Version 1 - ETH_PLUGIN_INTERFACE_VERSION_LATEST = 2, + ETH_PLUGIN_INTERFACE_VERSION_2 = 2, + ETH_PLUGIN_INTERFACE_VERSION_LATEST = 3, } eth_plugin_interface_version_t; typedef enum { @@ -165,6 +166,8 @@ typedef struct ethQueryContractUI_t { ethPluginSharedRO_t *pluginSharedRO; uint8_t *pluginContext; uint8_t screenIndex; + char network_ticker[MAX_TICKER_LEN]; + char *title; size_t titleLength; char *msg; diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index ad0a1f6..8b9339b 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -98,10 +98,10 @@ customStatus_e customProcessor(txContext_t *context) { blockSize = 32 - (dataContext.tokenContext.fieldOffset % 32); } - // Sanity check + // If the last parameter is of type `bytes` then we might have an + // edge case where the data is not a multiple of 32. Set `blockSize` accordingly if ((context->currentFieldLength - fieldPos) < blockSize) { - PRINTF("Unconsistent data\n"); - return CUSTOM_FAULT; + blockSize = context->currentFieldLength - fieldPos; } copySize = (context->commandLength < blockSize ? context->commandLength : blockSize);