From 53d67418e56acc6ffa105be01015ac02cee76705 Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Tue, 30 Nov 2021 14:19:32 +0100 Subject: [PATCH 1/9] Fix stark order signatures on LNS --- src/stark_utils.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/stark_utils.c b/src/stark_utils.c index 5344ba4..4df86e9 100644 --- a/src/stark_utils.c +++ b/src/stark_utils.c @@ -94,7 +94,6 @@ void pedersen(FieldElement res, /* out */ memcpy(res, hash + 1, FIELD_ELEMENT_SIZE); } -#ifdef TARGET_NANOX void shift_stark_hash(FieldElement hash) { uint256_t hash256, final_hash256; readu256BE(hash, &hash256); @@ -112,7 +111,6 @@ void shift_stark_hash(FieldElement hash) { THROW(0x6A80); } } -#endif // TARGET_NANOX int stark_sign(uint8_t *signature, /* out */ uint8_t *privateKeyData, @@ -137,9 +135,7 @@ int stark_sign(uint8_t *signature, /* out */ } pedersen(hash, hash, msg); PRINTF("Pedersen hash 2 %.*H\n", 32, hash); -#ifdef TARGET_NANOX shift_stark_hash(hash); -#endif cx_ecfp_init_private_key(CX_CURVE_Stark256, privateKeyData, 32, &privateKey); io_seproxyhal_io_heartbeat(); int signatureLength = cx_ecdsa_sign(&privateKey, From 24f4ecd6718b296ee080650c7b03db4c131c4a8e Mon Sep 17 00:00:00 2001 From: TamtamHero <10632523+TamtamHero@users.noreply.github.com> Date: Tue, 30 Nov 2021 14:20:15 +0100 Subject: [PATCH 2/9] Bump version 1.9.14 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8748d1f..1a5efba 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=13 +APPVERSION_P=14 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) From c8bf437424644f01aba21109bbced6973619ee59 Mon Sep 17 00:00:00 2001 From: Noel Moldvai Date: Tue, 14 Sep 2021 15:15:45 -0700 Subject: [PATCH 3/9] Add Shyft support --- Makefile | 8 ++++++-- icons/nanos_app_shyft.gif | Bin 0 -> 73 bytes icons/nanox_app_shyft.gif | Bin 0 -> 76 bytes src/chainConfig.h | 3 ++- src/main.c | 6 ++++++ src/tokens.c | 2 ++ src/tokens.h | 2 ++ 7 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 icons/nanos_app_shyft.gif create mode 100644 icons/nanox_app_shyft.gif diff --git a/Makefile b/Makefile index 1a5efba..1adad22 100755 --- a/Makefile +++ b/Makefile @@ -234,9 +234,13 @@ else ifeq ($(CHAIN),polygon) APP_LOAD_PARAMS += --path "44'/60'" DEFINES += CHAINID_UPCASE=\"POLYGON\" CHAINID_COINNAME=\"MATIC\" CHAIN_KIND=CHAIN_KIND_POLYGON CHAIN_ID=137 APPNAME = "Polygon" +else ifeq ($(CHAIN),shyft) +APP_LOAD_PARAMS += --path "44'/7341'" +DEFINES += CHAINID_UPCASE=\"SHYFT\" CHAINID_COINNAME=\"SHFT\" CHAIN_KIND=CHAIN_KIND_SHYFT CHAIN_ID=7341 +APPNAME = "Shyft" else ifeq ($(filter clean,$(MAKECMDGOALS)),) -$(error Unsupported CHAIN - use ethereum, ropsten, goerli, moonriver, 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, bsc, songbird, polygon) +$(error Unsupported CHAIN - use ethereum, ropsten, goerli, moonriver, 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, bsc, songbird, polygon, shyft) endif endif @@ -407,4 +411,4 @@ include $(BOLOS_SDK)/Makefile.rules dep/%.d: %.c Makefile listvariants: - @echo VARIANTS CHAIN ethereum ropsten goerli moonriver 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 bsc songbird polygon + @echo VARIANTS CHAIN ethereum ropsten goerli moonriver 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 bsc songbird polygon shyft diff --git a/icons/nanos_app_shyft.gif b/icons/nanos_app_shyft.gif new file mode 100644 index 0000000000000000000000000000000000000000..3a07de0390d9834ecf69cc6baa8979dea2b5a1ce GIT binary patch literal 73 zcmZ?wbhEHb6krfwXkcUjg8%>jEB<6*WHaWT}kb%J(0LNGssQ>@~ literal 0 HcmV?d00001 diff --git a/icons/nanox_app_shyft.gif b/icons/nanox_app_shyft.gif new file mode 100644 index 0000000000000000000000000000000000000000..fd1cb06d1ec317d5398e2ecaf7fd50cc67882983 GIT binary patch literal 76 zcmZ?wbh9u|6_GT#!5ilWa@>%GnPOHdq&g7EAXP WrH8ck{HR>?X{xNKtya1SgEau0$`q#n literal 0 HcmV?d00001 diff --git a/src/chainConfig.h b/src/chainConfig.h index 3a174a1..733a1a6 100644 --- a/src/chainConfig.h +++ b/src/chainConfig.h @@ -57,7 +57,8 @@ typedef enum chain_kind_e { CHAIN_KIND_FLARE, CHAIN_KIND_BSC, CHAIN_KIND_SONGBIRD, - CHAIN_KIND_POLYGON + CHAIN_KIND_POLYGON, + CHAIN_KIND_SHYFT } chain_kind_t; typedef struct chain_config_s { diff --git a/src/main.c b/src/main.c index 11358e7..999d1d9 100644 --- a/src/main.c +++ b/src/main.c @@ -266,6 +266,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { case CHAIN_KIND_POLYGON: numTokens = NUM_TOKENS_POLYGON; break; + case CHAIN_KIND_SHYFT: + numTokens = NUM_TOKENS_SHYFT; + break; } for (i = 0; i < numTokens; i++) { switch (chainConfig->kind) { @@ -374,6 +377,9 @@ tokenDefinition_t *getKnownToken(uint8_t *contractAddress) { case CHAIN_KIND_POLYGON: currentToken = (tokenDefinition_t *) PIC(&TOKENS_POLYGON[i]); break; + case CHAIN_KIND_SHYFT: + currentToken = (tokenDefinition_t *) PIC(&TOKENS_SHYFT[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 b6a9181..e1ddb5f 100644 --- a/src/tokens.c +++ b/src/tokens.c @@ -192,4 +192,6 @@ const tokenDefinition_t const TOKENS_MOONRIVER[NUM_TOKENS_MOONRIVER] = {}; const tokenDefinition_t const TOKENS_POLYGON[NUM_TOKENS_POLYGON] = {}; +const tokenDefinition_t const TOKENS_SHYFT[NUM_TOKENS_SHYFT] = {}; + #endif diff --git a/src/tokens.h b/src/tokens.h index 45c7460..4c3b2ee 100644 --- a/src/tokens.h +++ b/src/tokens.h @@ -101,6 +101,7 @@ static const uint8_t LEDGER_SIGNATURE_PUBLIC_KEY[] = { #define NUM_TOKENS_SONGBIRD 0 #define NUM_TOKENS_MOONRIVER 0 #define NUM_TOKENS_POLYGON 0 +#define NUM_TOKENS_SHYFT 0 extern tokenDefinition_t const TOKENS_AKROMA[NUM_TOKENS_AKROMA]; extern tokenDefinition_t const TOKENS_ELLAISM[NUM_TOKENS_ELLAISM]; @@ -137,6 +138,7 @@ extern tokenDefinition_t const TOKENS_BSC[NUM_TOKENS_BSC]; extern tokenDefinition_t const TOKENS_SONGBIRD[NUM_TOKENS_SONGBIRD]; extern tokenDefinition_t const TOKENS_MOONRIVER[NUM_TOKENS_MOONRIVER]; extern tokenDefinition_t const TOKENS_POLYGON[NUM_TOKENS_POLYGON]; +extern tokenDefinition_t const TOKENS_SHYFT[NUM_TOKENS_SHYFT]; #endif /* HAVE_TOKENS_LIST */ From 5a1dcb0b028d887a07673a02e56724bcf5b88092 Mon Sep 17 00:00:00 2001 From: tjulien-ledger Date: Tue, 14 Dec 2021 17:05:06 +0100 Subject: [PATCH 4/9] adding ETH path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1adad22..a1317a2 100755 --- a/Makefile +++ b/Makefile @@ -235,7 +235,7 @@ APP_LOAD_PARAMS += --path "44'/60'" DEFINES += CHAINID_UPCASE=\"POLYGON\" CHAINID_COINNAME=\"MATIC\" CHAIN_KIND=CHAIN_KIND_POLYGON CHAIN_ID=137 APPNAME = "Polygon" else ifeq ($(CHAIN),shyft) -APP_LOAD_PARAMS += --path "44'/7341'" +APP_LOAD_PARAMS += --path "44'/7341'" --path "44'/60'" DEFINES += CHAINID_UPCASE=\"SHYFT\" CHAINID_COINNAME=\"SHFT\" CHAIN_KIND=CHAIN_KIND_SHYFT CHAIN_ID=7341 APPNAME = "Shyft" else From abc66abc51642d0794da5e12a631c77442511032 Mon Sep 17 00:00:00 2001 From: tjulien-ledger Date: Tue, 14 Dec 2021 17:57:57 +0100 Subject: [PATCH 5/9] bump 1.9.14-shyft --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1317a2..6453af6 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=14 +APPVERSION_P=15-shyft APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) From a096f48e1e3f58ad7201c61be1e54befbb96116c Mon Sep 17 00:00:00 2001 From: tjulien-ledger Date: Tue, 14 Dec 2021 18:15:14 +0100 Subject: [PATCH 6/9] Update version bump to 1.9.16 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6453af6..8e3d975 100755 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=15-shyft +APPVERSION_P=16 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION) From 8055a65868298788eefb96fe65564ed9aa959265 Mon Sep 17 00:00:00 2001 From: tjulien-ledger Date: Wed, 12 Jan 2022 16:49:47 +0100 Subject: [PATCH 7/9] removed unnecessary derivation path --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8e3d975..d65af42 100755 --- a/Makefile +++ b/Makefile @@ -235,7 +235,7 @@ APP_LOAD_PARAMS += --path "44'/60'" DEFINES += CHAINID_UPCASE=\"POLYGON\" CHAINID_COINNAME=\"MATIC\" CHAIN_KIND=CHAIN_KIND_POLYGON CHAIN_ID=137 APPNAME = "Polygon" else ifeq ($(CHAIN),shyft) -APP_LOAD_PARAMS += --path "44'/7341'" --path "44'/60'" +APP_LOAD_PARAMS += --path "44'/60'" DEFINES += CHAINID_UPCASE=\"SHYFT\" CHAINID_COINNAME=\"SHFT\" CHAIN_KIND=CHAIN_KIND_SHYFT CHAIN_ID=7341 APPNAME = "Shyft" else From eb531de5d220f84177543bbdc0b91cff8011e0b6 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 14 Jan 2022 17:32:17 +0100 Subject: [PATCH 8/9] [clean] Linting pass --- src/eth_plugin_handler.c | 4 +- src/main.c | 2 +- src/shared_context.h | 8 ++-- .../cmd_provideNFTInfo.c | 28 +++++------ src_features/setPlugin/cmd_setPlugin.c | 22 ++++----- src_plugins/erc1155/erc1155_plugin.c | 2 +- src_plugins/erc1155/erc1155_plugin.h | 8 ++-- .../erc1155/erc1155_provide_parameters.c | 47 ++++++++----------- src_plugins/erc1155/erc1155_ui.c | 8 ++-- src_plugins/erc721/erc721_plugin.c | 2 +- src_plugins/erc721/erc721_plugin.h | 2 +- .../erc721/erc721_provide_parameters.c | 2 +- src_plugins/erc721/erc721_ui.c | 4 +- 13 files changed, 65 insertions(+), 74 deletions(-) diff --git a/src/eth_plugin_handler.c b/src/eth_plugin_handler.c index a6e685e..b82c6a5 100644 --- a/src/eth_plugin_handler.c +++ b/src/eth_plugin_handler.c @@ -133,7 +133,7 @@ eth_plugin_result_t eth_plugin_perform_init(uint8_t *contractAddress, #ifdef HAVE_NFT_SUPPORT case ERC1155: case ERC721: -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT case EXTERNAL: eth_plugin_perform_init_default(contractAddress, init); contractAddress = NULL; @@ -277,7 +277,7 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) { erc1155_plugin_call(method, parameter); break; } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT case OLD_INTERNAL: { // Perform the call for (i = 0;; i++) { diff --git a/src/main.c b/src/main.c index 7799632..a06bac0 100644 --- a/src/main.c +++ b/src/main.c @@ -528,7 +528,7 @@ void handleApdu(unsigned int *flags, unsigned int *tx) { flags, tx); break; -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT case INS_SET_EXTERNAL_PLUGIN: handleSetExternalPlugin(G_io_apdu_buffer[OFFSET_P1], diff --git a/src/shared_context.h b/src/shared_context.h index b5c944f..035f7c2 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -204,10 +204,10 @@ extern const internalStorage_t N_storage_real; extern bool called_from_swap; typedef enum { - EXTERNAL, // External plugin, set by setExternalPlugin. - ERC721, // Specific ERC721 internal plugin, set by setPlugin. - ERC1155, // Specific ERC1155 internal plugin, set by setPlugin - OLD_INTERNAL // Old internal plugin, not set by any command. + EXTERNAL, // External plugin, set by setExternalPlugin. + ERC721, // Specific ERC721 internal plugin, set by setPlugin. + ERC1155, // Specific ERC1155 internal plugin, set by setPlugin + OLD_INTERNAL // Old internal plugin, not set by any command. } pluginType_t; extern pluginType_t pluginType; diff --git a/src_features/provideNFTInformation/cmd_provideNFTInfo.c b/src_features/provideNFTInformation/cmd_provideNFTInfo.c index 1495f2c..a4256a3 100644 --- a/src_features/provideNFTInformation/cmd_provideNFTInfo.c +++ b/src_features/provideNFTInformation/cmd_provideNFTInfo.c @@ -18,8 +18,8 @@ #define MIN_DER_SIG_SIZE 67 #define MAX_DER_SIG_SIZE 72 -#define TEST_NFT_METADATA_KEY 0 -#define PROD_NFT_METADATA_KEY 1 +#define TEST_NFT_METADATA_KEY 0 +#define PROD_NFT_METADATA_KEY 1 #define ALGORITHM_ID_1 1 @@ -29,18 +29,18 @@ static const uint8_t LEDGER_NFT_METADATA_PUBLIC_KEY[] = { #ifdef HAVE_NFT_TESTING_KEY - 0x04, 0xf5, 0x70, 0x0c, 0xa1, 0xe8, 0x74, 0x24, 0xc7, 0xc7, 0xd1, 0x19, 0xe7, - 0xe3, 0xc1, 0x89, 0xb1, 0x62, 0x50, 0x94, 0xdb, 0x6e, 0xa0, 0x40, 0x87, 0xc8, - 0x30, 0x00, 0x7d, 0x0b, 0x46, 0x9a, 0x53, 0x11, 0xee, 0x6a, 0x1a, 0xcd, 0x1d, - 0xa5, 0xaa, 0xb0, 0xf5, 0xc6, 0xdf, 0x13, 0x15, 0x8d, 0x28, 0xcc, 0x12, 0xd1, - 0xdd, 0xa6, 0xec, 0xe9, 0x46, 0xb8, 0x9d, 0x5c, 0x05, 0x49, 0x92, 0x59, 0xc4 + 0x04, 0xf5, 0x70, 0x0c, 0xa1, 0xe8, 0x74, 0x24, 0xc7, 0xc7, 0xd1, 0x19, 0xe7, 0xe3, + 0xc1, 0x89, 0xb1, 0x62, 0x50, 0x94, 0xdb, 0x6e, 0xa0, 0x40, 0x87, 0xc8, 0x30, 0x00, + 0x7d, 0x0b, 0x46, 0x9a, 0x53, 0x11, 0xee, 0x6a, 0x1a, 0xcd, 0x1d, 0xa5, 0xaa, 0xb0, + 0xf5, 0xc6, 0xdf, 0x13, 0x15, 0x8d, 0x28, 0xcc, 0x12, 0xd1, 0xdd, 0xa6, 0xec, 0xe9, + 0x46, 0xb8, 0x9d, 0x5c, 0x05, 0x49, 0x92, 0x59, 0xc4 #else - 0x04, 0x98, 0x8d, 0xa6, 0xb2, 0x46, 0xf2, 0x8e, 0x77, 0xc1, 0xba, 0xb6, 0x75, - 0xcb, 0x2a, 0x27, 0x44, 0xf7, 0xf5, 0xce, 0xc5, 0x6a, 0xe6, 0xe0, 0x32, 0x23, - 0x33, 0x7b, 0x57, 0x94, 0xcd, 0x6a, 0xe0, 0x7d, 0x48, 0xb3, 0x0d, 0xb9, 0xcc, - 0xb4, 0x0f, 0x5a, 0x02, 0xa1, 0x1a, 0x3a, 0xb9, 0x9d, 0x5f, 0x59, 0x5a, 0x3d, - 0x50, 0xa0, 0xe1, 0x30, 0x23, 0xfd, 0x0d, 0x95, 0x87, 0x92, 0xd7, 0x97, 0x01 + 0x04, 0x98, 0x8d, 0xa6, 0xb2, 0x46, 0xf2, 0x8e, 0x77, 0xc1, 0xba, 0xb6, 0x75, 0xcb, + 0x2a, 0x27, 0x44, 0xf7, 0xf5, 0xce, 0xc5, 0x6a, 0xe6, 0xe0, 0x32, 0x23, 0x33, 0x7b, + 0x57, 0x94, 0xcd, 0x6a, 0xe0, 0x7d, 0x48, 0xb3, 0x0d, 0xb9, 0xcc, 0xb4, 0x0f, 0x5a, + 0x02, 0xa1, 0x1a, 0x3a, 0xb9, 0x9d, 0x5f, 0x59, 0x5a, 0x3d, 0x50, 0xa0, 0xe1, 0x30, + 0x23, 0xfd, 0x0d, 0x95, 0x87, 0x92, 0xd7, 0x97, 0x01 #endif }; @@ -176,7 +176,7 @@ void handleProvideNFTInformation(uint8_t p1, switch (algorithmId) { case ALGORITHM_ID_1: curve = CX_CURVE_256K1; - verificationFn = (verificationAlgo*)cx_ecdsa_verify; + verificationFn = (verificationAlgo *) cx_ecdsa_verify; hashId = CX_SHA256; break; default: @@ -227,4 +227,4 @@ void handleProvideNFTInformation(uint8_t p1, THROW(0x9000); } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_features/setPlugin/cmd_setPlugin.c b/src_features/setPlugin/cmd_setPlugin.c index ea39aa2..d2969f7 100644 --- a/src_features/setPlugin/cmd_setPlugin.c +++ b/src_features/setPlugin/cmd_setPlugin.c @@ -46,17 +46,17 @@ typedef enum AlgorithmID { // Only used for signing NFT plugins (ERC721 and ERC1155) static const uint8_t LEDGER_NFT_SELECTOR_PUBLIC_KEY[] = { #ifdef HAVE_NFT_TESTING_KEY - 0x04, 0xf5, 0x70, 0x0c, 0xa1, 0xe8, 0x74, 0x24, 0xc7, 0xc7, 0xd1, 0x19, 0xe7, - 0xe3, 0xc1, 0x89, 0xb1, 0x62, 0x50, 0x94, 0xdb, 0x6e, 0xa0, 0x40, 0x87, 0xc8, - 0x30, 0x00, 0x7d, 0x0b, 0x46, 0x9a, 0x53, 0x11, 0xee, 0x6a, 0x1a, 0xcd, 0x1d, - 0xa5, 0xaa, 0xb0, 0xf5, 0xc6, 0xdf, 0x13, 0x15, 0x8d, 0x28, 0xcc, 0x12, 0xd1, - 0xdd, 0xa6, 0xec, 0xe9, 0x46, 0xb8, 0x9d, 0x5c, 0x05, 0x49, 0x92, 0x59, 0xc4 + 0x04, 0xf5, 0x70, 0x0c, 0xa1, 0xe8, 0x74, 0x24, 0xc7, 0xc7, 0xd1, 0x19, 0xe7, 0xe3, + 0xc1, 0x89, 0xb1, 0x62, 0x50, 0x94, 0xdb, 0x6e, 0xa0, 0x40, 0x87, 0xc8, 0x30, 0x00, + 0x7d, 0x0b, 0x46, 0x9a, 0x53, 0x11, 0xee, 0x6a, 0x1a, 0xcd, 0x1d, 0xa5, 0xaa, 0xb0, + 0xf5, 0xc6, 0xdf, 0x13, 0x15, 0x8d, 0x28, 0xcc, 0x12, 0xd1, 0xdd, 0xa6, 0xec, 0xe9, + 0x46, 0xb8, 0x9d, 0x5c, 0x05, 0x49, 0x92, 0x59, 0xc4 #else - 0x04, 0xd8, 0x62, 0x6e, 0x01, 0x9e, 0x55, 0x3e, 0x19, 0x69, 0x56, 0xf1, 0x17, - 0x4d, 0xcd, 0xb8, 0x9a, 0x1c, 0xda, 0xc4, 0x93, 0x90, 0x08, 0xbc, 0x79, 0x77, - 0x33, 0x6d, 0x78, 0x24, 0xee, 0xe3, 0xa2, 0x62, 0x24, 0x1a, 0x62, 0x73, 0x52, - 0x3b, 0x09, 0xb8, 0xd0, 0xce, 0x0d, 0x39, 0xe8, 0x60, 0xc9, 0x4d, 0x02, 0x53, - 0x58, 0xdb, 0xdc, 0x25, 0x92, 0xc7, 0xc6, 0x48, 0x0d, 0x39, 0xce, 0xbb, 0xa3 + 0x04, 0xd8, 0x62, 0x6e, 0x01, 0x9e, 0x55, 0x3e, 0x19, 0x69, 0x56, 0xf1, 0x17, 0x4d, + 0xcd, 0xb8, 0x9a, 0x1c, 0xda, 0xc4, 0x93, 0x90, 0x08, 0xbc, 0x79, 0x77, 0x33, 0x6d, + 0x78, 0x24, 0xee, 0xe3, 0xa2, 0x62, 0x24, 0x1a, 0x62, 0x73, 0x52, 0x3b, 0x09, 0xb8, + 0xd0, 0xce, 0x0d, 0x39, 0xe8, 0x60, 0xc9, 0x4d, 0x02, 0x53, 0x58, 0xdb, 0xdc, 0x25, + 0x92, 0xc7, 0xc6, 0x48, 0x0d, 0x39, 0xce, 0xbb, 0xa3 #endif }; @@ -209,7 +209,7 @@ void handleSetPlugin(uint8_t p1, switch (algorithmId) { case ECC_SECG_P256K1__ECDSA_SHA_256: curve = CX_CURVE_256K1; - verificationFn = (verificationAlgo*)cx_ecdsa_verify; + verificationFn = (verificationAlgo *) cx_ecdsa_verify; hashId = CX_SHA256; break; default: diff --git a/src_plugins/erc1155/erc1155_plugin.c b/src_plugins/erc1155/erc1155_plugin.c index 7eebd8c..dbc1b8e 100644 --- a/src_plugins/erc1155/erc1155_plugin.c +++ b/src_plugins/erc1155/erc1155_plugin.c @@ -139,4 +139,4 @@ void erc1155_plugin_call(int message, void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc1155/erc1155_plugin.h b/src_plugins/erc1155/erc1155_plugin.h index 22462a8..0702fdf 100644 --- a/src_plugins/erc1155/erc1155_plugin.h +++ b/src_plugins/erc1155/erc1155_plugin.h @@ -34,9 +34,9 @@ typedef enum { } erc1155_selector_field; typedef struct erc1155_context_t { - uint8_t address[ADDRESS_LENGTH]; - uint8_t tokenId[INT256_LENGTH]; - uint256_t value; + uint8_t address[ADDRESS_LENGTH]; + uint8_t tokenId[INT256_LENGTH]; + uint256_t value; uint16_t ids_array_len; uint32_t ids_offset; @@ -52,4 +52,4 @@ typedef struct erc1155_context_t { void handle_provide_parameter_1155(void *parameters); void handle_query_contract_ui_1155(void *parameters); -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc1155/erc1155_provide_parameters.c b/src_plugins/erc1155/erc1155_provide_parameters.c index 59da428..800aafb 100644 --- a/src_plugins/erc1155/erc1155_provide_parameters.c +++ b/src_plugins/erc1155/erc1155_provide_parameters.c @@ -30,7 +30,7 @@ static void handle_safe_transfer(ethPluginProvideParameter_t *msg, erc1155_conte } static void handle_batch_transfer(ethPluginProvideParameter_t *msg, erc1155_context_t *context) { - uint256_t new_value; + uint256_t new_value; switch (context->next_param) { case FROM: @@ -41,23 +41,19 @@ static void handle_batch_transfer(ethPluginProvideParameter_t *msg, erc1155_cont context->next_param = TOKEN_IDS_OFFSET; break; case TOKEN_IDS_OFFSET: - context->ids_offset = \ - U4BE(msg->parameter, - PARAMETER_LENGTH - sizeof(context->ids_offset)) + 4; + context->ids_offset = + U4BE(msg->parameter, PARAMETER_LENGTH - sizeof(context->ids_offset)) + 4; context->next_param = VALUE_OFFSET; break; case VALUE_OFFSET: - context->values_offset = \ - U4BE(msg->parameter, - PARAMETER_LENGTH - sizeof(context->values_offset)) + 4; + context->values_offset = + U4BE(msg->parameter, PARAMETER_LENGTH - sizeof(context->values_offset)) + 4; context->next_param = TOKEN_IDS_LENGTH; break; case TOKEN_IDS_LENGTH: - if ((msg->parameterOffset + PARAMETER_LENGTH) > context->ids_offset) - { - context->ids_array_len = \ - U2BE(msg->parameter, - PARAMETER_LENGTH - sizeof(context->ids_array_len)); + if ((msg->parameterOffset + PARAMETER_LENGTH) > context->ids_offset) { + context->ids_array_len = + U2BE(msg->parameter, PARAMETER_LENGTH - sizeof(context->ids_array_len)); context->next_param = TOKEN_ID; // set to zero for next step context->array_index = 0; @@ -65,20 +61,16 @@ static void handle_batch_transfer(ethPluginProvideParameter_t *msg, erc1155_cont break; case TOKEN_ID: // don't copy anything since we won't display it - if (--context->ids_array_len == 0) - { + if (--context->ids_array_len == 0) { context->next_param = VALUE_LENGTH; } context->array_index++; break; case VALUE_LENGTH: - if ((msg->parameterOffset + PARAMETER_LENGTH) > context->values_offset) - { - context->values_array_len = \ - U2BE(msg->parameter, - PARAMETER_LENGTH - sizeof(context->values_array_len)); - if (context->values_array_len != context->array_index) - { + if ((msg->parameterOffset + PARAMETER_LENGTH) > context->values_offset) { + context->values_array_len = + U2BE(msg->parameter, PARAMETER_LENGTH - sizeof(context->values_array_len)); + if (context->values_array_len != context->array_index) { PRINTF("Token ids and values array sizes mismatch!"); } context->next_param = VALUE; @@ -92,8 +84,7 @@ static void handle_batch_transfer(ethPluginProvideParameter_t *msg, erc1155_cont copy_parameter(context->tokenId, msg->parameter, sizeof(context->value)); convertUint256BE(context->tokenId, sizeof(context->tokenId), &new_value); add256(&context->value, &new_value, &context->value); - if (--context->values_array_len == 0) - { + if (--context->values_array_len == 0) { context->next_param = NONE; } context->array_index++; @@ -132,10 +123,10 @@ void handle_provide_parameter_1155(void *parameters) { msg->result = ETH_PLUGIN_RESULT_SUCCESSFUL; - //if (context->targetOffset > SELECTOR_SIZE && - // context->targetOffset != msg->parameterOffset - SELECTOR_SIZE) { - // return; - //} + // if (context->targetOffset > SELECTOR_SIZE && + // context->targetOffset != msg->parameterOffset - SELECTOR_SIZE) { + // return; + // } switch (context->selectorIndex) { case SAFE_TRANSFER: handle_safe_transfer(msg, context); @@ -153,4 +144,4 @@ void handle_provide_parameter_1155(void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc1155/erc1155_ui.c b/src_plugins/erc1155/erc1155_ui.c index 5237a16..5b4e941 100644 --- a/src_plugins/erc1155/erc1155_ui.c +++ b/src_plugins/erc1155/erc1155_ui.c @@ -59,7 +59,7 @@ static void set_transfer_ui(ethQueryContractUI_t *msg, erc1155_context_t *contex break; case 2: strlcpy(msg->title, "NFT Address", msg->titleLength); - getEthDisplayableAddress((uint8_t *)msg->item1->nft.contractAddress, + getEthDisplayableAddress((uint8_t *) msg->item1->nft.contractAddress, msg->msg, msg->msgLength, &global_sha3, @@ -84,7 +84,7 @@ static void set_transfer_ui(ethQueryContractUI_t *msg, erc1155_context_t *contex } static void set_batch_transfer_ui(ethQueryContractUI_t *msg, erc1155_context_t *context) { - char quantity_str[48]; + char quantity_str[48]; switch (msg->screenIndex) { case 0: @@ -105,7 +105,7 @@ static void set_batch_transfer_ui(ethQueryContractUI_t *msg, erc1155_context_t * break; case 2: strlcpy(msg->title, "NFT Address", msg->titleLength); - getEthDisplayableAddress((uint8_t *)msg->item1->nft.contractAddress, + getEthDisplayableAddress((uint8_t *) msg->item1->nft.contractAddress, msg->msg, msg->msgLength, &global_sha3, @@ -149,4 +149,4 @@ void handle_query_contract_ui_1155(void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc721/erc721_plugin.c b/src_plugins/erc721/erc721_plugin.c index 4bdd232..badddb3 100644 --- a/src_plugins/erc721/erc721_plugin.c +++ b/src_plugins/erc721/erc721_plugin.c @@ -147,4 +147,4 @@ void erc721_plugin_call(int message, void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc721/erc721_plugin.h b/src_plugins/erc721/erc721_plugin.h index 2ab80df..1846609 100644 --- a/src_plugins/erc721/erc721_plugin.h +++ b/src_plugins/erc721/erc721_plugin.h @@ -43,4 +43,4 @@ typedef struct erc721_context_t { void handle_provide_parameter_721(void *parameters); void handle_query_contract_ui_721(void *parameters); -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc721/erc721_provide_parameters.c b/src_plugins/erc721/erc721_provide_parameters.c index a315af0..ac5b870 100644 --- a/src_plugins/erc721/erc721_provide_parameters.c +++ b/src_plugins/erc721/erc721_provide_parameters.c @@ -94,4 +94,4 @@ void handle_provide_parameter_721(void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT diff --git a/src_plugins/erc721/erc721_ui.c b/src_plugins/erc721/erc721_ui.c index bb8264c..e312932 100644 --- a/src_plugins/erc721/erc721_ui.c +++ b/src_plugins/erc721/erc721_ui.c @@ -115,7 +115,7 @@ static void set_transfer_ui(ethQueryContractUI_t *msg, erc721_context_t *context break; case 2: strlcpy(msg->title, "NFT Address", msg->titleLength); - getEthDisplayableAddress((uint8_t *)msg->item1->nft.contractAddress, + getEthDisplayableAddress((uint8_t *) msg->item1->nft.contractAddress, msg->msg, msg->msgLength, &global_sha3, @@ -167,4 +167,4 @@ void handle_query_contract_ui_721(void *parameters) { } } -#endif // HAVE_NFT_SUPPORT +#endif // HAVE_NFT_SUPPORT From b124cd26b8a749651629adf5198bf7ca97662aa1 Mon Sep 17 00:00:00 2001 From: Alexandre Paillier Date: Fri, 14 Jan 2022 15:34:23 +0100 Subject: [PATCH 9/9] Version bump to 1.9.17 --- CHANGELOG.md | 10 ++++++++-- Makefile | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c8def5..9b72ae0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +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.15](https://github.com/ledgerhq/app-ethereum/compare/1.9.14...1.9.15) - 2021-12-15 +## [1.9.17](https://github.com/ledgerhq/app-ethereum/compare/1.9.16...1.9.17) - 2022-01-14 ### Added -- Support for Non-Fungible Token (ERC-721 & ERC-1155) +- Support for Non-Fungible Tokens (ERC-721 & ERC-1155) + +## [1.9.16](https://github.com/ledgerhq/app-ethereum/compare/1.9.14...1.9.16) - 2022-01-13 + +### Added + +- Shyft variant ## [1.9.14](https://github.com/ledgerhq/app-ethereum/compare/1.9.13...1.9.14) - 2021-11-30 diff --git a/Makefile b/Makefile index fec5006..4607051 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ APP_LOAD_PARAMS += --path "1517992542'/1101353413'" APPVERSION_M=1 APPVERSION_N=9 -APPVERSION_P=16 +APPVERSION_P=17 APPVERSION=$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P) APP_LOAD_FLAGS= --appFlags 0x240 --dep Ethereum:$(APPVERSION)