]> zoso.dev Git - libnemo.git/commitdiff
Add stress test for deriving 2^15 accounts which is skipped by default.
authorChris Duncan <chris@zoso.dev>
Fri, 8 Nov 2024 17:03:59 +0000 (09:03 -0800)
committerChris Duncan <chris@zoso.dev>
Fri, 8 Nov 2024 17:03:59 +0000 (09:03 -0800)
test/derive-accounts.test.mjs

index 81153acf1ab344aa798e8868bfcc55868d0eaf85..1b0864e35b2c4f7f602a77211ff30fd5891b23b2 100644 (file)
@@ -8,6 +8,8 @@ import { strict as assert } from 'assert'
 import { NANO_TEST_VECTORS, STORAGE } from './TEST_VECTORS.js'\r
 import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js'\r
 \r
+const skip = true\r
+\r
 // WARNING: Do not send any funds to the test vectors below\r
 // Test vectors from https://docs.nano.org/integration-guides/key-management/ and elsewhere\r
 describe('derive child accounts from the same seed', async () => {\r
@@ -86,3 +88,23 @@ describe('Ledger device accounts', { skip: true }, async () => {
                assert.ok(accounts[0].address)\r
        })\r
 })\r
+\r
+describe('child key derivation performance', { skip }, async () => {\r
+       it('performance test of BIP-44 ckd', async function () {\r
+               const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD)\r
+               await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
+\r
+               const accounts = await wallet.accounts(0, 0x7fff)\r
+\r
+               assert.equal(accounts.length, 0x8000)\r
+       })\r
+\r
+       it('performance test of BLAKE2b ckd', async function () {\r
+               const wallet = await Blake2bWallet.create(NANO_TEST_VECTORS.PASSWORD)\r
+               await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
+\r
+               const accounts = await wallet.accounts(0, 0x7fff)\r
+\r
+               assert.equal(accounts.length, 0x8000)\r
+       })\r
+})\r