Skip to content

Commit

Permalink
feat!: remove shimmer cointype support
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Oct 4, 2024
1 parent 663ac02 commit 4515850
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions rust-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
6 changes: 1 addition & 5 deletions rust-app/src/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions ts-tests/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 }
16 changes: 8 additions & 8 deletions ts-tests/public-key-tests.ts
Original file line number Diff line number Diff line change
@@ -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', () => {

Expand All @@ -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;
}, []);
});
Expand Down
4 changes: 2 additions & 2 deletions ts-tests/signing-tests.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 =
[
Expand Down

0 comments on commit 4515850

Please sign in to comment.