From 3ad17ca4774d1a1eab830af942676ed33a8b01af Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Thu, 10 Sep 2026 16:29:06 +0000 Subject: [PATCH] core: pin simplexmq for the BIP-44 path, and use it ethereumPath now takes the address index, so the path a name key sits at is built once in the library rather than again here. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Rvc3HbiWBTqbAvRT45G5oX --- cabal.project | 2 +- scripts/nix/sha256map.nix | 2 +- src/Simplex/Chat/Wallet.hs | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/cabal.project b/cabal.project index 0a6efd7a2f..663a118ffd 100644 --- a/cabal.project +++ b/cabal.project @@ -21,7 +21,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: a23da20fb53eb6e43012aa5ee305ed41f7f6f6ab + tag: 22987046875e2a7e40ef3c1d3cba89879b437581 source-repository-package type: git diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index 7b99c12b39..80bc848215 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."a23da20fb53eb6e43012aa5ee305ed41f7f6f6ab" = "1s0m80i0z7b5x7xx2rqkzqv28zaxmmfm4x1vkgka1vb9qxmpb1p1"; + "https://github.com/simplex-chat/simplexmq.git"."22987046875e2a7e40ef3c1d3cba89879b437581" = "1xx1id2xq2l0wk9qqbwnykpyw5w7sicq28rwg44c7rxpx7gyj6dx"; "https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38"; "https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d"; "https://github.com/simplex-chat/sqlcipher-simple.git"."a46bd361a19376c5211f1058908fc0ae6bf42446" = "1z0r78d8f0812kxbgsm735qf6xx8lvaz27k1a0b4a2m0sshpd5gl"; diff --git a/src/Simplex/Chat/Wallet.hs b/src/Simplex/Chat/Wallet.hs index a5cfa61ce3..304de1f807 100644 --- a/src/Simplex/Chat/Wallet.hs +++ b/src/Simplex/Chat/Wallet.hs @@ -30,6 +30,7 @@ import Data.Word (Word32) import qualified Simplex.Messaging.Crypto.BIP32 as B32 import qualified Simplex.Messaging.Crypto.BIP39 as B39 import qualified Simplex.Messaging.Crypto.Secp256k1 as S +import Simplex.Messaging.Eth.Address (ethereumPath) type SeedId = Int64 @@ -64,15 +65,11 @@ seedMaster s = do m <- B39.entropyToMnemonic (wsEntropy s) B32.masterKey (B39.mnemonicToSeed m "") --- | So the phrase reaches the same addresses in other wallets. -nameKeyPath :: AccountIndex -> NameIndex -> [Word32] -nameKeyPath acc nm = [B32.hardened 44, B32.hardened 60, B32.hardened acc, 0, nm] - renderNameKeyPath :: AccountIndex -> NameIndex -> Text -renderNameKeyPath acc nm = decodeLatin1 . B32.renderPath $ nameKeyPath acc nm +renderNameKeyPath acc nm = decodeLatin1 . B32.renderPath $ ethereumPath acc nm deriveNameKey :: B32.ExtendedKey -> AccountIndex -> NameIndex -> Either String S.PrivateKey -deriveNameKey master acc nm = B32.xkKey <$> B32.derivePath master (nameKeyPath acc nm) +deriveNameKey master acc nm = B32.xkKey <$> B32.derivePath master (ethereumPath acc nm) -- | As wallets take it when a key is imported on its own. nameKeySecret :: S.PrivateKey -> ByteString