From 61e7d174428fd1c3866026075a1d790a7a4484fe Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 15 Jun 2021 11:15:01 +0200 Subject: [PATCH 01/13] Add bsc variant --- Makefile | 4 ++++ ethereum-plugin-sdk | 2 +- src/chainConfig.h | 3 ++- src/main.c | 6 ++++++ src/tokens.c | 2 ++ src/tokens.h | 2 ++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bfd27bf..dd46397 100755 --- a/Makefile +++ b/Makefile @@ -200,6 +200,10 @@ else ifeq ($(CHAIN),theta) APP_LOAD_PARAMS += --path "44'/500'" --path "44'/60'" DEFINES += CHAINID_UPCASE=\"THETA\" CHAINID_COINNAME=\"THETA\" CHAIN_KIND=CHAIN_KIND_THETA CHAIN_ID=500 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" 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/ethereum-plugin-sdk b/ethereum-plugin-sdk index 75bf9f4..a232fcd 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit 75bf9f421ff7c15cfd92c75f2131ffcc622c44b3 +Subproject commit a232fcd3ca8f3f5ee3c23af16b7621c7604c65a7 diff --git a/src/chainConfig.h b/src/chainConfig.h index 4cbd5ab..a845018 100644 --- a/src/chainConfig.h +++ b/src/chainConfig.h @@ -54,7 +54,8 @@ typedef enum chain_kind_e { CHAIN_KIND_WEBCHAIN, CHAIN_KIND_THUNDERCORE, CHAIN_KIND_FLARE, - CHAIN_KIND_THETA + CHAIN_KIND_THETA, + CHAIN_KIND_BSC } chain_kind_t; typedef struct chain_config_s { diff --git a/src/main.c b/src/main.c index e5344eb..6039069 100644 --- a/src/main.c +++ b/src/main.c @@ -270,6 +270,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { case CHAIN_KIND_THETA: numTokens = NUM_TOKENS_THETA; break; + case CHAIN_KIND_BSC: + numTokens = NUM_TOKENS_BSC; + break; } for (i = 0; i < numTokens; i++) { switch (chainConfig->kind) { @@ -368,6 +371,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { break case CHAIN_KIND_THETA : currentToken = (tokenDefinition_t *) PIC(&TOKENS_THETA[i]); break; + case CHAIN_KIND_BSC: + currentToken = (tokenDefinition_t *) PIC(&TOKENS_BSC[i]); + break; } if (memcmp(currentToken->address, tmpContent.txContent.destination, ADDRESS_LENGTH) == 0) { return currentToken; diff --git a/src/tokens.c b/src/tokens.c index c524a3a..63667e8 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -4566,4 +4566,6 @@ const tokenDefinition_t const TOKENS_FLARE[NUM_TOKENS_FLARE] = {}; const tokenDefinition_t const TOKENS_THETA[NUM_TOKENS_THETA] = {}; +const tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC] = {}; + #endif diff --git a/src/tokens.h b/src/tokens.h index 8c69127..1deec6f 100644 --- a/src/tokens.h +++ b/src/tokens.h @@ -96,6 +96,7 @@ static const uint8_t const LEDGER_SIGNATURE_PUBLIC_KEY[] = { #define NUM_TOKENS_THUNDERCORE 0 #define NUM_TOKENS_FLARE 0 #define NUM_TOKENS_THETA 0 +#define NUM_TOKENS_BSC 0 extern tokenDefinition_t const TOKENS_AKROMA[NUM_TOKENS_AKROMA]; extern tokenDefinition_t const TOKENS_ELLAISM[NUM_TOKENS_ELLAISM]; @@ -129,6 +130,7 @@ extern tokenDefinition_t const TOKENS_WEBCHAIN[NUM_TOKENS_WEBCHAIN]; extern tokenDefinition_t const TOKENS_THUNDERCORE[NUM_TOKENS_THUNDERCORE]; extern tokenDefinition_t const TOKENS_FLARE[NUM_TOKENS_FLARE]; extern tokenDefinition_t const TOKENS_THETA[NUM_TOKENS_THETA]; +extern tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC]; #endif /* HAVE_TOKENS_LIST */ From db5fe05902ec49b09f388648d721f2f40fd2cf26 Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 15 Jun 2021 11:17:31 +0200 Subject: [PATCH 02/13] Bump version to rc1 and add to CHANGELOG --- CHANGELOG.md | 6 ++++++ Makefile | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 773668e..2580e68 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.8.6](https://github.com/ledgerhq/app-ethereum/compare/1.7.9...1.8.6) - 2021-6-15 + +### Added + +Added support for BSC. + ## [1.8.5](https://github.com/ledgerhq/app-ethereum/compare/1.7.9...1.8.5) - 2021-6-8 ### Added diff --git a/Makefile b/Makefile index dd46397..e5f0850 100755 --- a/Makefile +++ b/Makefile @@ -30,8 +30,8 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=8 -APPVERSION_P=5 -APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) +APPVERSION_P=6 +APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-rc1 APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) ifeq ($(CHAIN),) From de3978ca7e224691d319be5ffb66d564302cd945 Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 15 Jun 2021 11:26:10 +0200 Subject: [PATCH 03/13] Update plugin sdk --- ethereum-plugin-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index a232fcd..806c14f 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit a232fcd3ca8f3f5ee3c23af16b7621c7604c65a7 +Subproject commit 806c14fd733332b027912488ffc1aaec56fe6e6c From c40ea9dae4c8b6bbc69e935e1638a199a8708a10 Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 15 Jun 2021 15:25:11 +0200 Subject: [PATCH 04/13] Update Changelog --- CHANGELOG.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2580e68..2985fc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,45 +9,48 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Added -Added support for BSC. +- Added support for BSC. +- Added icons for Flare. +- Allowed an extra derivation path for Theta. + ## [1.8.5](https://github.com/ledgerhq/app-ethereum/compare/1.7.9...1.8.5) - 2021-6-8 ### Added -Added support for external plugins. +- Added support for external plugins. ## [1.7.9](https://github.com/ledgerhq/app-ethereum/compare/1.7.8...1.7.9) - 2021-6-2 ### Added -Added support for Flare Network and Theta Chain. +- Added support for Flare Network and Theta Chain. ## [1.7.8](https://github.com/ledgerhq/app-ethereum/compare/1.7.7...1.7.8) - 2021-5-20 ### Fixed -Fixed a bug where transaction would sometimes not get properly signed. +- Fixed a bug where transaction would sometimes not get properly signed. ## [1.7.7](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.7) - 2021-5-19 ### Special -Version bump needed for deployment reasons, nothing changed. +- Version bump needed for deployment reasons, nothing changed. ## [1.7.6](https://github.com/ledgerhq/app-ethereum/compare/1.7.5...1.7.6) - 2021-5-14 ### Special -Version bump needed for deployment reasons, nothing changed. +- Version bump needed for deployment reasons, nothing changed. ## [1.7.7](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.7) - 2021-5-19 -N/A +- N/A ## [1.7.6](https://github.com/ledgerhq/app-ethereum/compare/1.7.6...1.7.6) - 2021-5-14 -N/A +- N/A ## [1.7.5](https://github.com/ledgerhq/app-ethereum/compare/1.7.4...1.7.5) - 2021-5-10 From be59465acfb270112549e2b1b5aab42ae56b3d74 Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 15 Jun 2021 15:25:23 +0200 Subject: [PATCH 05/13] bump to rc2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e5f0850..362eea5 100755 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=8 APPVERSION_P=6 -APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-rc1 +APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-rc2 APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) ifeq ($(CHAIN),) From bb9da691a1b00ca26be589744c7e3255c1810b1e Mon Sep 17 00:00:00 2001 From: pscott Date: Wed, 16 Jun 2021 14:24:07 +0200 Subject: [PATCH 06/13] Add bsc to variants --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 362eea5..5ab2eba 100755 --- a/Makefile +++ b/Makefile @@ -370,4 +370,4 @@ include $(BOLOS_SDK)/Makefile.rules dep/%.d: %.c Makefile listvariants: - @echo VARIANTS CHAIN ethereum ropsten ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore flare flare_coston theta + @echo VARIANTS CHAIN ethereum ropsten ethereum_classic expanse poa rsk rsk_testnet ubiq wanchain pirl akroma atheios callisto ethersocial ether1 gochain musicoin ethergem mix ellaism reosc hpb tomochain dexon volta ewc thundercore flare flare_coston theta bsc From d2907130f2659a920a1e72cf72eec8966c0841b9 Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Fri, 25 Jun 2021 10:32:46 +0200 Subject: [PATCH 07/13] Add BSC icons --- icons/nanos_app_bsc.gif | Bin 0 -> 71 bytes icons/nanox_app_bsc.gif | Bin 0 -> 68 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 icons/nanos_app_bsc.gif create mode 100644 icons/nanox_app_bsc.gif diff --git a/icons/nanos_app_bsc.gif b/icons/nanos_app_bsc.gif new file mode 100644 index 0000000000000000000000000000000000000000..4154097effcd90ae11b833c0f8c061eaa26aec89 GIT binary patch literal 71 zcmZ?wbhEHb6krfw_`t{j1poj4SNzEWVln7|2#^c|lUz&x%F}Q2oftM5dA@G>>DQzC UV7sQ`l8N(5i{5eTvocr%0Is Date: Thu, 15 Jul 2021 12:00:11 +0200 Subject: [PATCH 08/13] Repair provideERC20TokenInformation for side chains when using eth app --- .../provideErc20TokenInformation/cmd_provideTokenInfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src_features/provideErc20TokenInformation/cmd_provideTokenInfo.c b/src_features/provideErc20TokenInformation/cmd_provideTokenInfo.c index 5f73191..518a13a 100644 --- a/src_features/provideErc20TokenInformation/cmd_provideTokenInfo.c +++ b/src_features/provideErc20TokenInformation/cmd_provideTokenInfo.c @@ -143,8 +143,8 @@ void handleProvideErc20TokenInformation(uint8_t p1, offset += 4; dataLength -= 4; chainId = U4BE(workBuffer, offset); - if ((chainConfig->chainId != 0) && (chainConfig->chainId != chainId)) { - PRINTF("ChainId token mismatch\n"); + if ((chainConfig->chainId != ETHEREUM_MAINNET_CHAINID) && (chainConfig->chainId != chainId)) { + PRINTF("ChainId token mismatch: %d vs %d\n", chainConfig->chainId, chainId); THROW(0x6A80); } offset += 4; From 4b42d69b3ede014a4ded2ac12c55ecbd6d59ccbd Mon Sep 17 00:00:00 2001 From: pscott Date: Fri, 16 Jul 2021 11:50:52 +0200 Subject: [PATCH 09/13] Add Lido contracts --- src_plugins/erc20/erc20_plugin.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src_plugins/erc20/erc20_plugin.c b/src_plugins/erc20/erc20_plugin.c index d3ba536..00fdd55 100644 --- a/src_plugins/erc20/erc20_plugin.c +++ b/src_plugins/erc20/erc20_plugin.c @@ -27,7 +27,7 @@ typedef struct contract_t { uint8_t address[ADDRESS_LENGTH]; } contract_t; -#define NUM_CONTRACTS 11 +#define NUM_CONTRACTS 13 const contract_t CONTRACTS[NUM_CONTRACTS] = { // Compound {"Compound DAI", {0x5d, 0x3a, 0x53, 0x6e, 0x4d, 0x6d, 0xbd, 0x61, 0x14, 0xcc, @@ -52,7 +52,15 @@ const contract_t CONTRACTS[NUM_CONTRACTS] = { 0x48, 0x73, 0xd0, 0x0f, 0xf8, 0x5b, 0xcc, 0xde, 0xd5, 0x50}}, // Paraswap {"Paraswap", {0x1b, 0xd4, 0x35, 0xf3, 0xc0, 0x54, 0xb6, 0xe9, 0x01, 0xb7, - 0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}}}; + 0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}} + + // stETH + {"Lido", {0x7f, 0x39, 0xc5, 0x81, 0xf5, 0x95, 0xb5, 0x3c, 0x5c, 0xb1, + 0x9b, 0xd0, 0xb3, 0xf8, 0xda, 0x6c, 0x93, 0x5e, 0x2c, 0xa0}}, + + // wstETH + {"Wrapped stETH", {0xae, 0x7a, 0xb9, 0x65, 0x20, 0xde, 0x3a, 0x18, 0xe5, 0xe1, + 0x11, 0xb5, 0xea, 0xab, 0x09, 0x53, 0x12, 0xd7, 0xfe, 0x84}}}; bool check_contract(erc20_parameters_t *context) { for (size_t i = 0; i < NUM_CONTRACTS; i++) { From b8b2f7f5241dfcacc7fd8b591b8a61513fa3b600 Mon Sep 17 00:00:00 2001 From: Jean P <10632523+TamtamHero@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:13:16 +0200 Subject: [PATCH 10/13] Apply clang-format to plugin sdk when checking it (#172) * Add clang-format step before verifying plugin-sdk integrity * update plugin sdk --- Makefile | 1 + ethereum-plugin-sdk | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a3cd567..477bc06 100755 --- a/Makefile +++ b/Makefile @@ -340,6 +340,7 @@ endif # rebuild $(shell python3 ethereum-plugin-sdk/build_sdk.py) +$(shell find ./ethereum-plugin-sdk -iname '*.h' -o -iname '*.c' | xargs clang-format-10 -i) # check if a difference is noticed (fail if it happens in CI build) ifneq ($(shell git status | grep 'ethereum-plugin-sdk'),) diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index aeaf645..82909e4 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit aeaf6450c32c8134a7d19b1852554771ca8bc4be +Subproject commit 82909e4f902b4448aa308f571ca4c4e8c5880124 From 5672cee156ea38996c0391ebb10cc733cb821a1d Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Mon, 19 Jul 2021 16:15:56 +0200 Subject: [PATCH 11/13] Bump version 1.8.8-rc1 to match current max version on provider 4 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5ab2eba..486e9a1 100755 --- a/Makefile +++ b/Makefile @@ -30,8 +30,8 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=8 -APPVERSION_P=6 -APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-rc2 +APPVERSION_P=8 +APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)-rc1 APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) ifeq ($(CHAIN),) From 6d0f09b4c753cd79db79ef2a191aebacc8521b34 Mon Sep 17 00:00:00 2001 From: Edouard Merle Date: Mon, 19 Jul 2021 09:55:09 +0200 Subject: [PATCH 12/13] adding missing comma in contract names --- Makefile | 2 +- src_plugins/erc20/erc20_plugin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a3cd567..8c1ae03 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=8 -APPVERSION_P=7 +APPVERSION_P=8 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) diff --git a/src_plugins/erc20/erc20_plugin.c b/src_plugins/erc20/erc20_plugin.c index 00fdd55..0e9cca5 100644 --- a/src_plugins/erc20/erc20_plugin.c +++ b/src_plugins/erc20/erc20_plugin.c @@ -52,7 +52,7 @@ const contract_t CONTRACTS[NUM_CONTRACTS] = { 0x48, 0x73, 0xd0, 0x0f, 0xf8, 0x5b, 0xcc, 0xde, 0xd5, 0x50}}, // Paraswap {"Paraswap", {0x1b, 0xd4, 0x35, 0xf3, 0xc0, 0x54, 0xb6, 0xe9, 0x01, 0xb7, - 0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}} + 0xb1, 0x08, 0xa0, 0xab, 0x76, 0x17, 0xc8, 0x08, 0x67, 0x7b}}, // stETH {"Lido", {0x7f, 0x39, 0xc5, 0x81, 0xf5, 0x95, 0xb5, 0x3c, 0x5c, 0xb1, From 6060fa8b16d9565a198c90d67131f3222321d4d1 Mon Sep 17 00:00:00 2001 From: pscott Date: Tue, 27 Jul 2021 11:22:17 +0200 Subject: [PATCH 13/13] Update plugin sdk --- ethereum-plugin-sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ethereum-plugin-sdk b/ethereum-plugin-sdk index 82909e4..806c14f 160000 --- a/ethereum-plugin-sdk +++ b/ethereum-plugin-sdk @@ -1 +1 @@ -Subproject commit 82909e4f902b4448aa308f571ca4c4e8c5880124 +Subproject commit 806c14fd733332b027912488ffc1aaec56fe6e6c