diff --git a/src/eth_plugin_handler.c b/src/eth_plugin_handler.c index 13e1e7a..da1cac9 100644 --- a/src/eth_plugin_handler.c +++ b/src/eth_plugin_handler.c @@ -147,7 +147,7 @@ eth_plugin_result_t eth_plugin_call(int method, void *parameter) { switch (method) { case ETH_PLUGIN_INIT_CONTRACT: ((ethPluginInitContract_t *) parameter)->interfaceVersion = - ETH_PLUGIN_INTERFACE_VERSION_2; + ETH_PLUGIN_INTERFACE_VERSION_1; ((ethPluginInitContract_t *) parameter)->result = ETH_PLUGIN_RESULT_UNAVAILABLE; ((ethPluginInitContract_t *) parameter)->pluginSharedRW = &pluginRW; ((ethPluginInitContract_t *) parameter)->pluginSharedRO = &pluginRO; diff --git a/src/eth_plugin_interface.h b/src/eth_plugin_interface.h index dc0e754..556e348 100644 --- a/src/eth_plugin_interface.h +++ b/src/eth_plugin_interface.h @@ -12,7 +12,6 @@ // 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_2 = 2 // Add dataPresent to txContent } eth_plugin_interface_version_t; typedef enum { diff --git a/src/main.c b/src/main.c index d366361..2a67cb5 100644 --- a/src/main.c +++ b/src/main.c @@ -778,7 +778,6 @@ void coin_main(chain_config_t *coin_config) { #endif storage.contractDetails = 0x00; storage.displayNonce = 0x00; - storage.displayFeeDetails = 0x00; storage.initialized = 0x01; nvm_write((void *) &N_storage, (void *) &storage, sizeof(internalStorage_t)); } diff --git a/src/shared_context.h b/src/shared_context.h index 7b35b21..7a884b3 100644 --- a/src/shared_context.h +++ b/src/shared_context.h @@ -30,7 +30,6 @@ typedef struct internalStorage_t { unsigned char dataAllowed; unsigned char contractDetails; unsigned char displayNonce; - unsigned char displayFeeDetails; uint8_t initialized; } internalStorage_t; @@ -166,8 +165,7 @@ typedef enum { typedef struct txStringProperties_t { char fullAddress[43]; char fullAmount[50]; - char maxFee[50]; // Used as BaseFee when detailing fees - char priorityFee[50]; + char maxFee[50]; char nonce[8]; // 10M tx per account ought to be enough for everybody char chainID[8]; // 10M different chainID ought to be enough for people to find a unique // chainID for their token / chain. diff --git a/src/ui_flow.c b/src/ui_flow.c index 841a100..6bac181 100644 --- a/src/ui_flow.c +++ b/src/ui_flow.c @@ -5,7 +5,6 @@ void display_settings(const ux_flow_step_t* const start_step); void switch_settings_contract_data(void); void switch_settings_display_data(void); void switch_settings_display_nonce(void); -void switch_settings_display_fee_details(void); ////////////////////////////////////////////////////////////////////// // clang-format off @@ -79,15 +78,6 @@ UX_STEP_CB( .text = strings.common.fullAddress + 26 }); -UX_STEP_CB( - ux_settings_flow_4_step, - bnnn_paging, - switch_settings_display_fee_details(), - { - .title = "Fee Details", - .text = strings.common.fullAddress + 40 - }); - #else UX_STEP_CB( @@ -123,21 +113,10 @@ UX_STEP_CB( strings.common.fullAddress + 26 }); - UX_STEP_CB( - ux_settings_flow_4_step, - bnnn, - switch_settings_display_fee_details(), - { - "Fee Details", - "Display fee details", - "when available", - strings.common.fullAddress + 40 - }); - #endif UX_STEP_CB( - ux_settings_flow_5_step, + ux_settings_flow_4_step, pb, ui_idle(), { @@ -150,8 +129,7 @@ UX_FLOW(ux_settings_flow, &ux_settings_flow_1_step, &ux_settings_flow_2_step, &ux_settings_flow_3_step, - &ux_settings_flow_4_step, - &ux_settings_flow_5_step); + &ux_settings_flow_4_step); void display_settings(const ux_flow_step_t* const start_step) { strcpy(strings.common.fullAddress, (N_storage.dataAllowed ? "Allowed" : "NOT Allowed")); @@ -159,8 +137,6 @@ void display_settings(const ux_flow_step_t* const start_step) { (N_storage.contractDetails ? "Displayed" : "NOT Displayed")); strcpy(strings.common.fullAddress + 26, (N_storage.displayNonce ? "Displayed" : "NOT Displayed")); - strcpy(strings.common.fullAddress + 40, - (N_storage.displayFeeDetails ? "Displayed" : "NOT Displayed")); ux_flow_init(0, ux_settings_flow, start_step); } @@ -181,9 +157,3 @@ void switch_settings_display_nonce() { nvm_write((void*) &N_storage.displayNonce, (void*) &value, sizeof(uint8_t)); display_settings(&ux_settings_flow_3_step); } - -void switch_settings_display_fee_details() { - uint8_t value = (N_storage.displayFeeDetails ? 0 : 1); - nvm_write((void*) &N_storage.displayFeeDetails, (void*) &value, sizeof(uint8_t)); - display_settings(&ux_settings_flow_4_step); -} \ No newline at end of file diff --git a/src_common/ethUstream.c b/src_common/ethUstream.c index 7f1643c..17f5641 100644 --- a/src_common/ethUstream.c +++ b/src_common/ethUstream.c @@ -168,28 +168,6 @@ static void processNonce(txContext_t *context) { } } -static void processMaxPriorityFeePerGas(txContext_t *context) { - PRINTF("PRIORITY\n"); - if (context->currentFieldIsList) { - PRINTF("Invalid type for RLP_MAX_PRIORITY_FEE_PER_GAS\n"); - THROW(EXCEPTION); - } - if (context->currentFieldLength > MAX_INT256) { - PRINTF("Invalid length for RLP_MAX_PRIORITY_FEE_PER_GAS\n"); - THROW(EXCEPTION); - } - if (context->currentFieldPos < context->currentFieldLength) { - uint32_t copySize = - MIN(context->commandLength, context->currentFieldLength - context->currentFieldPos); - copyTxData(context, context->content->maxPriorityFeePerGas.value + context->currentFieldPos, copySize); - } - if (context->currentFieldPos == context->currentFieldLength) { - context->content->maxPriorityFeePerGas.length = context->currentFieldLength; - context->currentField++; - context->processingField = false; - } -} - static void processStartGas(txContext_t *context) { if (context->currentFieldIsList) { PRINTF("Invalid type for RLP_STARTGAS\n"); @@ -358,10 +336,6 @@ static bool processEIP1559Tx(txContext_t *context) { processNonce(context); break; } - case EIP1559_RLP_MAX_PRIORITY_FEE_PER_GAS: { - processMaxPriorityFeePerGas(context); - break; - } case EIP1559_RLP_MAX_FEE_PER_GAS: { processGasprice(context); break; @@ -390,6 +364,7 @@ static bool processEIP1559Tx(txContext_t *context) { processV(context); break; } + case EIP1559_RLP_MAX_PRIORITY_FEE_PER_GAS: case EIP1559_RLP_SENDER_R: case EIP1559_RLP_SENDER_S: processAndDiscard(context); diff --git a/src_common/ethUstream.h b/src_common/ethUstream.h index 41fcedf..4ba337a 100644 --- a/src_common/ethUstream.h +++ b/src_common/ethUstream.h @@ -127,7 +127,6 @@ typedef struct txInt256_t { typedef struct txContent_t { txInt256_t gasprice; // Used as MaxFeePerGas when dealing with EIP1559 transactions. txInt256_t startgas; // Also known as `gasLimit`. - txInt256_t maxPriorityFeePerGas; txInt256_t value; txInt256_t nonce; txInt256_t chainID; diff --git a/src_features/signTx/logic_signTx.c b/src_features/signTx/logic_signTx.c index dd6f6f8..d35d1dd 100644 --- a/src_features/signTx/logic_signTx.c +++ b/src_features/signTx/logic_signTx.c @@ -251,32 +251,8 @@ void prepareAndCopyFees(txInt256_t *BEGasPrice, txInt256_t *BEGasLimit, char *di feesToString(&rawFee, displayBuffer, displayBufferSize); } -static void prepareAndCopyDetailedFees() { - uint256_t rawPriorityFee = {0}; - uint256_t rawMaxFee = {0}; - uint256_t rawBaseFee = {0}; - - // Compute the priorityFee and the maxFee. - computeFees(&tmpContent.txContent.maxPriorityFeePerGas, &tmpContent.txContent.startgas, &rawPriorityFee); - computeFees(&tmpContent.txContent.gasprice, &tmpContent.txContent.startgas, &rawMaxFee); - // Substract priorityFee from maxFee -> this is the baseFee - minus256(&rawMaxFee, &rawPriorityFee, &rawBaseFee); - - // Transform priorityFee to string (with a ticker). - PRINTF("Computing priority fee\n"); - feesToString(&rawPriorityFee, strings.common.priorityFee, sizeof(strings.common.priorityFee)); - - PRINTF("Computing base fee\n"); - // Transform priorityFee to string (with a ticker). - feesToString(&rawBaseFee, strings.common.maxFee, sizeof(strings.common.maxFee)); -} - void prepareFeeDisplay() { - if (N_storage.displayFeeDetails) { - prepareAndCopyDetailedFees(); - } else { - prepareAndCopyFees(&tmpContent.txContent.gasprice, &tmpContent.txContent.startgas, strings.common.maxFee, sizeof(strings.common.maxFee)); - } + prepareAndCopyFees(&tmpContent.txContent.gasprice, &tmpContent.txContent.startgas, strings.common.maxFee, sizeof(strings.common.maxFee)); } uint32_t get_chainID() { diff --git a/src_features/signTx/ui_flow_signTx.c b/src_features/signTx/ui_flow_signTx.c index 6eb729b..f6992f6 100644 --- a/src_features/signTx/ui_flow_signTx.c +++ b/src_features/signTx/ui_flow_signTx.c @@ -216,20 +216,6 @@ UX_STEP_INIT( display_next_plugin_item(false); }); -UX_STEP_NOCB( - ux_approval_base_fee_step, - bnnn_paging, - { - .title = "Base Fee", - .text = strings.common.maxFee, - }); -UX_STEP_NOCB( - ux_approval_priority_fee_step, - bnnn_paging, - { - .title = "Priority Fee", - .text = strings.common.priorityFee, - }); UX_STEP_NOCB( ux_approval_fees_step, bnnn_paging, @@ -321,12 +307,7 @@ void ux_approve_tx(bool fromPlugin) { if (id != ETHEREUM_MAINNET_CHAINID) { ux_approval_tx_flow[step++] = &ux_approval_chainid_step; } - if (txContext.txType == EIP1559 && N_storage.displayFeeDetails) { - ux_approval_tx_flow[step++] = &ux_approval_base_fee_step; - ux_approval_tx_flow[step++] = &ux_approval_priority_fee_step; - } else { - ux_approval_tx_flow[step++] = &ux_approval_fees_step; - } + ux_approval_tx_flow[step++] = &ux_approval_fees_step; ux_approval_tx_flow[step++] = &ux_approval_accept_step; ux_approval_tx_flow[step++] = &ux_approval_reject_step; ux_approval_tx_flow[step++] = FLOW_END_STEP;