From: Chris Duncan Date: Tue, 19 Nov 2024 07:08:31 +0000 (-0800) Subject: Document test vector sources in TEST_VECTORS file, and remove repetitive warning... X-Git-Tag: v0.0.20~5 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=8e9c0b3cf816e36856bc74e5f46269b023147be2;p=libnemo.git Document test vector sources in TEST_VECTORS file, and remove repetitive warning from individual test files in favor of one very clear warning above test vector values. --- diff --git a/test/TEST_VECTORS.js b/test/TEST_VECTORS.js index 32bfdf9..c94e08b 100644 --- a/test/TEST_VECTORS.js +++ b/test/TEST_VECTORS.js @@ -1,6 +1,16 @@ // SPDX-FileCopyrightText: 2024 Chris Duncan // SPDX-License-Identifier: GPL-3.0-or-later +/** +* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING +* +* Do not send any funds to the test vectors below! +* +* Sources: +* https://docs.nano.org/integration-guides/key-management/ +* https://github.com/trezor/python-mnemonic/blob/master/vectors.json +* https://tools.nanos.cc/?tool=seed +*/ export const GENESIS_ADDRESS = 'nano_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3' export const RAW_MAX = '340282366920938463463374607431768211455' export const SUPPLY_MAX = '133248297920938463463374607431768211455' diff --git a/test/create-wallet.test.mjs b/test/create-wallet.test.mjs index 4e63dc3..946ef0f 100644 --- a/test/create-wallet.test.mjs +++ b/test/create-wallet.test.mjs @@ -9,10 +9,7 @@ import { strict as assert } from 'assert' import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js' -// 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('creating a new wallet', async () => { - it('BIP-44 wallet with random entropy', async () => { const wallet = await Bip44Wallet.create(NANO_TEST_VECTORS.PASSWORD) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) diff --git a/test/derive-accounts.test.mjs b/test/derive-accounts.test.mjs index f4833c1..616e3a2 100644 --- a/test/derive-accounts.test.mjs +++ b/test/derive-accounts.test.mjs @@ -9,8 +9,6 @@ import { strict as assert } from 'assert' import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' import { Bip44Wallet, Blake2bWallet, LedgerWallet } from '../dist/main.js' -// 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 function () { const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) diff --git a/test/import-wallet.test.mjs b/test/import-wallet.test.mjs index 30bc542..1ac1954 100644 --- a/test/import-wallet.test.mjs +++ b/test/import-wallet.test.mjs @@ -9,8 +9,6 @@ import { strict as assert } from 'assert' import { BIP32_TEST_VECTORS, CUSTOM_TEST_VECTORS, NANO_TEST_VECTORS, TREZOR_TEST_VECTORS } from './TEST_VECTORS.js' import { Account, Bip44Wallet, Blake2bWallet } from '../dist/main.js' -// 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('import wallet with test vectors test', () => { it('should successfully import a wallet with the official Nano test vectors mnemonic', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) diff --git a/test/lock-unlock-wallet.mjs b/test/lock-unlock-wallet.mjs index a67089f..e75b109 100644 --- a/test/lock-unlock-wallet.mjs +++ b/test/lock-unlock-wallet.mjs @@ -11,8 +11,6 @@ import { Bip44Wallet, Blake2bWallet } from '../dist/main.js' const skip = false -// 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('locking and unlocking a Bip44Wallet', { skip }, async () => { it('should succeed with a password', async () => { const wallet = await Bip44Wallet.fromMnemonic(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD) diff --git a/test/refresh-accounts.test.mjs b/test/refresh-accounts.test.mjs index 9dc71cc..52636ac 100644 --- a/test/refresh-accounts.test.mjs +++ b/test/refresh-accounts.test.mjs @@ -9,9 +9,6 @@ import { strict as assert } from 'assert' import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' import { Account, Bip44Wallet, Rpc } from '../dist/main.js' -// WARNING: Do not send any funds to the test vectors below -// Test vectors from https://docs.nano.org/integration-guides/key-management/ and elsewhere - const wallet = await Bip44Wallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED) await wallet.unlock(NANO_TEST_VECTORS.PASSWORD) const node = new Rpc(process.env.NODE_URL, process.env.API_KEY_NAME, process.env.API_KEY_VALUE) diff --git a/test/sign-blocks.test.mjs b/test/sign-blocks.test.mjs index 06b1790..e1e676b 100644 --- a/test/sign-blocks.test.mjs +++ b/test/sign-blocks.test.mjs @@ -9,8 +9,6 @@ import { strict as assert } from 'assert' import { NANO_TEST_VECTORS } from './TEST_VECTORS.js' import { SendBlock, ReceiveBlock, ChangeBlock } from '../dist/main.js' -// WARNING: Do not send any funds to the test vectors below -// Test vectors from https://docs.nano.org/integration-guides/key-management/ describe('valid blocks', async () => { it('should not allow negative balances', async () => { assert.throws(() => {