Fix Withdrawal key derivation path
This commit is contained in:
committed by
TamtamHero
parent
da43b51fbc
commit
235b4b1863
@@ -360,7 +360,7 @@ This command has been supported since firmware version 1.5.0
|
||||
|
||||
#### Description
|
||||
|
||||
This command sets the index of the Withdrawal key used as withdrawal credentials in an ETH2 deposit contract call signature. The path of the Withdrawal key starts with 12381/3600/0 according to EIP 2333 (https://eips.ethereum.org/EIPS/eip-2333)
|
||||
This command sets the index of the Withdrawal key used as withdrawal credentials in an ETH2 deposit contract call signature. The path of the Withdrawal key is defined as m/12381/3600/index/0 according to EIP 2334 (https://eips.ethereum.org/EIPS/eip-2334)
|
||||
|
||||
The default index used is 0 if this method isn't called before the deposit contract transaction is sent to the device to be signed
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ void getEth2PublicKey(uint32_t *bip32Path, uint8_t bip32PathLength, uint8_t *out
|
||||
|
||||
#define WITHDRAWAL_KEY_PATH_1 12381
|
||||
#define WITHDRAWAL_KEY_PATH_2 3600
|
||||
#define WITHDRAWAL_KEY_PATH_3 0
|
||||
#define WITHDRAWAL_KEY_PATH_4 0
|
||||
|
||||
#define ETH2_DEPOSIT_PUBKEY_OFFSET 0x80
|
||||
#define ETH2_WITHDRAWAL_CREDENTIALS_OFFSET 0xE0
|
||||
@@ -95,8 +95,8 @@ void eth2_plugin_call(int message, void *parameters) {
|
||||
uint32_t withdrawalKeyPath[4];
|
||||
withdrawalKeyPath[0] = WITHDRAWAL_KEY_PATH_1;
|
||||
withdrawalKeyPath[1] = WITHDRAWAL_KEY_PATH_2;
|
||||
withdrawalKeyPath[2] = WITHDRAWAL_KEY_PATH_3;
|
||||
withdrawalKeyPath[3] = eth2WithdrawalIndex;
|
||||
withdrawalKeyPath[2] = eth2WithdrawalIndex;
|
||||
withdrawalKeyPath[3] = WITHDRAWAL_KEY_PATH_4;
|
||||
getEth2PublicKey(withdrawalKeyPath, 4, tmp);
|
||||
PRINTF("eth2 plugin computed withdrawal public key %.*H\n", 48, tmp);
|
||||
cx_hash_sha256(tmp, 48, tmp, 32);
|
||||
|
||||
Reference in New Issue
Block a user