From 4515850f61203399c81d6099dece977b07a8c303 Mon Sep 17 00:00:00 2001 From: Thoralf-M Date: Fri, 4 Oct 2024 10:57:06 +0200 Subject: [PATCH] feat!: remove shimmer cointype support --- rust-app/Cargo.toml | 4 ++-- rust-app/src/implementation.rs | 6 +----- ts-tests/common.ts | 4 ++-- ts-tests/public-key-tests.ts | 16 ++++++++-------- ts-tests/signing-tests.ts | 4 ++-- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/rust-app/Cargo.toml b/rust-app/Cargo.toml index a3cb1f4..c070780 100644 --- a/rust-app/Cargo.toml +++ b/rust-app/Cargo.toml @@ -57,8 +57,8 @@ overflow-checks = false [package.metadata.ledger] name = "IOTA Rebased" -# Testnet, IOTA, Shimmer -path = ["44'/1'", "44'/4218'", "44'/4219'"] +# Testnet, IOTA +path = ["44'/1'", "44'/4218'"] curve = ["ed25519"] flags = "0" diff --git a/rust-app/src/implementation.rs b/rust-app/src/implementation.rs index 55b7124..767f7ba 100644 --- a/rust-app/src/implementation.rs +++ b/rust-app/src/implementation.rs @@ -60,13 +60,9 @@ pub const BIP32_TESTNET_PREFIX: [u32; 5] = ledger_device_sdk::ecc::make_bip32_path(b"m/44'/1'/123'/0'/0'"); pub const BIP32_IOTA_PREFIX: [u32; 5] = ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4218'/123'/0'/0'"); -pub const BIP32_SMR_PREFIX: [u32; 5] = - ledger_device_sdk::ecc::make_bip32_path(b"m/44'/4219'/123'/0'/0'"); fn is_bip_prefix_valid(path: &[u32]) -> bool { - path.starts_with(&BIP32_TESTNET_PREFIX[0..2]) - || path.starts_with(&BIP32_IOTA_PREFIX[0..2]) - || path.starts_with(&BIP32_SMR_PREFIX[0..2]) + path.starts_with(&BIP32_TESTNET_PREFIX[0..2]) || path.starts_with(&BIP32_IOTA_PREFIX[0..2]) } pub async fn get_address_apdu(io: HostIO, prompt: bool) { diff --git a/ts-tests/common.ts b/ts-tests/common.ts index 00d3a8b..f73ab46 100644 --- a/ts-tests/common.ts +++ b/ts-tests/common.ts @@ -4,7 +4,7 @@ import Iota from "./Iota"; import { expect } from 'chai'; const IOTA_BIP_PATH = "44'/4218'/0'/0'/0'"; -const SHIMMER_BIP_PATH = "44'/4219'/0'/0'/0'"; +const TESTNET_BIP_PATH = "44'/1'/0'/0'/0'"; export const VERSION = { major: 0, @@ -201,4 +201,4 @@ let toggleBlindSigningSettings = async function () { await Axios.post(BASE_URL + "/button/left", { "action": "press-and-release" }); } -export { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, SHIMMER_BIP_PATH, sendCommandExpectFail, toggleBlindSigningSettings } +export { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, TESTNET_BIP_PATH, sendCommandExpectFail, toggleBlindSigningSettings } diff --git a/ts-tests/public-key-tests.ts b/ts-tests/public-key-tests.ts index a876852..2673494 100644 --- a/ts-tests/public-key-tests.ts +++ b/ts-tests/public-key-tests.ts @@ -1,15 +1,15 @@ -import { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, SHIMMER_BIP_PATH } from "./common"; +import { sendCommandAndAccept, BASE_URL, IOTA_BIP_PATH, TESTNET_BIP_PATH } from "./common"; import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; import type Iota from "./Iota"; // Public key and address for default speculos mnemonic: "glory promote mansion idle axis finger extra february uncover one trip resource lawn turtle enact monster seven myth punch hobby comfort wild raise skin" -// with BIP32 Path: 44'/4218'/0'/0'/0' (Shimmer: 44'/4219'/0'/0'/0') +// with BIP32 Path: 44'/4218'/0'/0'/0' (Testnet: 44'/1'/0'/0'/0') const IOTA_PUBLIC_KEY = "f0a9c612b7e69f1a114aa9189c1f32997d395d09d183368ddfd6d5dc49e34647"; -const SHIMMER_PUBLIC_KEY = "d8e6a30365c5720f873feacc4002c5c75b91a0e813db4676b47f47aaad47e123"; +const TESTNET_PUBLIC_KEY = "TODO"; export const IOTA_ADDRESS = "1b3669e321893ee49c387a08fc251dbfff37cd2a981e6c473a5b2afde19d363e"; -export const SHIMMER_ADDRESS = "006699dd01f2ec78dd0dfc62ee416952480de084aa90e356729ee341db92fcba"; +export const TESTNET_ADDRESS = "3a0de157f4b6c4bed40caf93def86c3e6946ed35d27c7121ef264336973e9955"; describe('public key tests', () => { @@ -28,12 +28,12 @@ describe('public key tests', () => { }, []); }); - it('provides a public key shimmer coin type', async () => { + it('provides a public key testnet coin type', async () => { await sendCommandAndAccept(async (client: Iota) => { - const rv = await client.getPublicKey(SHIMMER_BIP_PATH); - expect(new Buffer(rv.publicKey).toString('hex')).to.equal(SHIMMER_PUBLIC_KEY); - expect(new Buffer(rv.address).toString('hex')).to.equal(SHIMMER_ADDRESS); + const rv = await client.getPublicKey(TESTNET_BIP_PATH); + expect(new Buffer(rv.publicKey).toString('hex')).to.equal(TESTNET_PUBLIC_KEY); + expect(new Buffer(rv.address).toString('hex')).to.equal(TESTNET_ADDRESS); return; }, []); }); diff --git a/ts-tests/signing-tests.ts b/ts-tests/signing-tests.ts index 80f9bab..29b8b23 100644 --- a/ts-tests/signing-tests.ts +++ b/ts-tests/signing-tests.ts @@ -1,4 +1,4 @@ -import { VERSION, sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleBlindSigningSettings, IOTA_BIP_PATH, SHIMMER_BIP_PATH } from "./common"; +import { VERSION, sendCommandAndAccept, BASE_URL, sendCommandExpectFail, toggleBlindSigningSettings, IOTA_BIP_PATH, TESTNET_BIP_PATH } from "./common"; import { expect } from 'chai'; import { describe, it } from 'mocha'; import Axios from 'axios'; @@ -115,7 +115,7 @@ describe("Signing tests", function () { }); it("can blind sign an unknown transaction", async function () { - const path = SHIMMER_BIP_PATH; + const path = TESTNET_BIP_PATH; const txn = Buffer.from("00000000050205546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e1284af431cf032b5d85324135bf9a3073e920d7f5020000000000000020a06f410c175e828c24cee84cb3bd95cff25c33fbbdcb62c6596e8e423784ffe702d08074075c7097f361e8b443e2075a852a2292e8a08074075c7097f361e8b443e2075a852a2292e80180969800000000001643fb2578ff7191c643079a62c1cca8ec2752bc05546e7f126d2f40331a543b9608439b582fd0d103000000000000002080fdabcc90498e7eb8413b140c4334871eeafa5a86203fd9cfdb032f604f49e101000000000000002c01000000000000", "hex"); const prompts = [