From 48c7e4ab8c68a6449914d43ff164600e63f6c467 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Fri, 20 Oct 2017 12:51:02 +0200 Subject: [PATCH] Backport #6815 and #6829 (#6837) * Tweaked snapshot sync threshold * Change keypath derivation logic (#6815) While the standard defined by Trezor as the default derivation path here https://blog.trezor.io/trezor-integration-with-myetherwallet-3e217a652e08 says that it should be `m/44'/60'/0`, in practice they don't have an implementation of a wallet for Ethereum themselves and refer customers to MEW. MEW has a custom implementation of the path derivation logic that allows them to generate multiple addresses by essentially adding `/0`, `/1` etc to the path. In my initial implementation of Trezor I didn't take this into consideration unfortunately and just used the keypath that Trezor themselves recommended. However, given that it's seemingly standard practice to append `/0` for a "sub-address" (and this is what we've done for Ledger as well) it seems like a mistake on my part to not take that into consideration. Unfortunately, anyone who has used their Trezor device with Parity previously would now see a different address when they connect the Trezor device the next time. The only way they would have to access the old address is to use an old version, or by going through MEW and selecting the Ledger keypath. Also see #6811 --- hw/src/trezor.rs | 4 ++-- sync/src/chain.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/src/trezor.rs b/hw/src/trezor.rs index a89d26f66..f6e55cd25 100644 --- a/hw/src/trezor.rs +++ b/hw/src/trezor.rs @@ -37,8 +37,8 @@ use trezor_sys::messages::{EthereumAddress, PinMatrixAck, MessageType, EthereumT const TREZOR_VID: u16 = 0x534c; const TREZOR_PIDS: [u16; 1] = [0x0001]; // Trezor v1, keeping this as an array to leave room for Trezor v2 which is in progress -const ETH_DERIVATION_PATH: [u32; 4] = [0x8000002C, 0x8000003C, 0x80000000, 0]; // m/44'/60'/0'/0 -const ETC_DERIVATION_PATH: [u32; 4] = [0x8000002C, 0x8000003D, 0x80000000, 0]; // m/44'/61'/0'/0 +const ETH_DERIVATION_PATH: [u32; 5] = [0x8000002C, 0x8000003C, 0x80000000, 0, 0]; // m/44'/60'/0'/0/0 +const ETC_DERIVATION_PATH: [u32; 5] = [0x8000002C, 0x8000003D, 0x80000000, 0, 0]; // m/44'/61'/0'/0/0 /// Hardware wallet error. diff --git a/sync/src/chain.rs b/sync/src/chain.rs index 8e2b9e9f5..f4c7fbf39 100644 --- a/sync/src/chain.rs +++ b/sync/src/chain.rs @@ -137,7 +137,7 @@ const MAX_TRANSACTION_PACKET_SIZE: usize = 8 * 1024 * 1024; // Maximal number of transactions in sent in single packet. const MAX_TRANSACTIONS_TO_PROPAGATE: usize = 64; // Min number of blocks to be behind for a snapshot sync -const SNAPSHOT_RESTORE_THRESHOLD: BlockNumber = 10000; +const SNAPSHOT_RESTORE_THRESHOLD: BlockNumber = 30000; const SNAPSHOT_MIN_PEERS: usize = 3; const STATUS_PACKET: u8 = 0x00;