Skip to content

Commit

Permalink
Merge pull request #337 from keepkey/fix-remove-cfunc
Browse files Browse the repository at this point in the history
remove obsolete cfunc code
  • Loading branch information
pastaghost authored Feb 22, 2023
2 parents f1c6345 + eced041 commit 2d9f039
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 270 deletions.
5 changes: 0 additions & 5 deletions include/keepkey/firmware/ethereum_contracts.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ bool ethereum_contractHandled(uint32_t data_total, const EthereumSignTx *msg,
/// \return true iff the user has confirmed the custom ETH signing request
bool ethereum_contractConfirmed(uint32_t data_total, const EthereumSignTx *msg,
const HDNode *node);

bool ethereum_cFuncHandled(const EthereumSignTx *msg);

bool ethereum_cFuncConfirmed(uint32_t data_total, const EthereumSignTx *msg);

#endif
34 changes: 0 additions & 34 deletions include/keepkey/firmware/ethereum_contracts/confuncs.h

This file was deleted.

1 change: 0 additions & 1 deletion lib/firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ set(sources
ethereum.c
ethereum_contracts.c
ethereum_contracts/makerdao.c
ethereum_contracts/contractfuncs.c
ethereum_contracts/saproxy.c
ethereum_contracts/zxappliquid.c
ethereum_contracts/thortx.c
Expand Down
24 changes: 0 additions & 24 deletions lib/firmware/ethereum.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,30 +698,6 @@ void ethereum_signing_init(EthereumSignTx *msg, const HDNode *node,
data_needs_confirm = false;
}

// contract function may be recognized even though contract is not, e.g., gnosis safe execTransaction
if (msg->to.size && ethereum_cFuncHandled(msg)) {
// confirm contract address
char addr[43] = "0x";
ethereum_address_checksum(msg->to.bytes, addr + 2, false, chain_id);

if (!confirm(ButtonRequestType_ButtonRequest_ConfirmOutput, "contract address", "%s", addr)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled,
"Signing cancelled by user");
ethereum_signing_abort();
return;
}

// confirm contract data
if (!ethereum_cFuncConfirmed(data_total, msg)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled,
"Signing cancelled by user");
ethereum_signing_abort();
return;
}
needs_confirm = false;
data_needs_confirm = false;
}

// detect ERC-20 token
if (data_total == 68 && ethereum_isStandardERC20Transfer(msg)) {
token = tokenByChainAddress(chain_id, msg->to.bytes);
Expand Down
14 changes: 0 additions & 14 deletions lib/firmware/ethereum_contracts.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "keepkey/firmware/ethereum_contracts.h"

#include "keepkey/firmware/ethereum_contracts/confuncs.h"
#include "keepkey/firmware/ethereum_contracts/saproxy.h"
#include "keepkey/firmware/ethereum_contracts/thortx.h"
#include "keepkey/firmware/ethereum_contracts/zxappliquid.h"
Expand All @@ -29,19 +28,6 @@
#include "keepkey/firmware/ethereum_contracts/zxswap.h"
#include "keepkey/firmware/ethereum_contracts/makerdao.h"


bool ethereum_cFuncHandled(const EthereumSignTx *msg) {
if (cf_isExecTx(msg)) return true; // used in gnosis proxy contracts
return false;
}

bool ethereum_cFuncConfirmed(uint32_t data_total, const EthereumSignTx *msg) {
if (cf_isExecTx(msg)) {
return cf_confirmExecTx(data_total, msg);
}
return false;
}

bool ethereum_contractHandled(uint32_t data_total, const EthereumSignTx *msg,
const HDNode *node) {
(void)node;
Expand Down
191 changes: 0 additions & 191 deletions lib/firmware/ethereum_contracts/contractfuncs.c

This file was deleted.

0 comments on commit 2d9f039

Please sign in to comment.