From 550fc86ba8899dbc0ed5d4e9ffbbad99b68edcd8 Mon Sep 17 00:00:00 2001 From: pscott Date: Thu, 22 Apr 2021 14:57:30 +0200 Subject: [PATCH] Remove INDEX_MAX from withdrawal_index.h ; set limit to 2^19 --- .../setEth2WithdrawalIndex/cmd_setEth2WithdrawalIndex.c | 5 ----- src_features/setEth2WithdrawalIndex/withdrawal_index.h | 2 -- src_plugins/eth2/eth2_plugin.c | 4 +++- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src_features/setEth2WithdrawalIndex/cmd_setEth2WithdrawalIndex.c b/src_features/setEth2WithdrawalIndex/cmd_setEth2WithdrawalIndex.c index 9a03986..c60631d 100644 --- a/src_features/setEth2WithdrawalIndex/cmd_setEth2WithdrawalIndex.c +++ b/src_features/setEth2WithdrawalIndex/cmd_setEth2WithdrawalIndex.c @@ -18,11 +18,6 @@ void handleSetEth2WithdrawalIndex(uint8_t p1, THROW(0x6B00); } - eth2WithdrawalIndex = U4BE(dataBuffer, 0); - if (eth2WithdrawalIndex > INDEX_MAX) { - THROW(0x6A80); // scott throw this error code or create new one ? - } - THROW(0x9000); } diff --git a/src_features/setEth2WithdrawalIndex/withdrawal_index.h b/src_features/setEth2WithdrawalIndex/withdrawal_index.h index f84535b..497b489 100644 --- a/src_features/setEth2WithdrawalIndex/withdrawal_index.h +++ b/src_features/setEth2WithdrawalIndex/withdrawal_index.h @@ -1,7 +1,5 @@ #include "stdint.h" -#define INDEX_MAX 1337 // scott - void handleSetEth2WithdrawalIndex(uint8_t p1, uint8_t p2, uint8_t *dataBuffer, diff --git a/src_plugins/eth2/eth2_plugin.c b/src_plugins/eth2/eth2_plugin.c index 4c38efd..4e3d49f 100644 --- a/src_plugins/eth2/eth2_plugin.c +++ b/src_plugins/eth2/eth2_plugin.c @@ -6,7 +6,6 @@ #include "shared_context.h" #include "ethUtils.h" #include "utils.h" -#include "withdrawal_index.h" void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out); @@ -24,6 +23,9 @@ void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out #define DEPOSIT_CONTRACT_ADDRESS "0x00000000219ab540356cbb839cbe05303d7705fa" #define DEPOSIT_CONTRACT_LENGTH sizeof(DEPOSIT_CONTRACT_ADDRESS) +// Highest index for withdrawal derivation path. +#define INDEX_MAX 524288 // 2 ^ 19 + typedef struct eth2_deposit_parameters_t { uint8_t valid; char deposit_address[ETH2_DEPOSIT_PUBKEY_LENGTH];