From: Chris Duncan Date: Fri, 8 Nov 2024 17:03:59 +0000 (-0800) Subject: Add stress test for deriving 2^15 accounts which is skipped by default. X-Git-Tag: v0.0.20~42 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=2c68a57975b466214831160eab879d98852f420b;p=libnemo.git Add stress test for deriving 2^15 accounts which is skipped by default. --- diff --git a/test/derive-accounts.test.mjs b/test/derive-accounts.test.mjs index 81153ac..1b0864e 100644 --- a/test/derive-accounts.test.mjs +++ b/test/derive-accounts.test.mjs @@ -8,6 +8,8 @@ import { strict as assert } from 'assert' import { NANO_TEST_VECTORS, STORAGE } from './TEST_VECTORS.js' import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js' +const skip = true + // WARNING: Do not send any funds to the test vectors below // Test vectors from https://docs.nano.org/integration-guides/key-management/ and elsewhere describe('derive child accounts from the same seed', async () => { @@ -86,3 +88,23 @@ describe('Ledger device accounts', { skip: true }, async () => { assert.ok(accounts[0].address) }) }) + +describe('child key derivation performance', { skip }, async () => { + it('performance test of BIP-44 ckd', async function () { + const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD) + await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + + const accounts = await wallet.accounts(0, 0x7fff) + + assert.equal(accounts.length, 0x8000) + }) + + it('performance test of BLAKE2b ckd', async function () { + const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD) + await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) + + const accounts = await wallet.accounts(0, 0x7fff) + + assert.equal(accounts.length, 0x8000) + }) +})