From: Chris Duncan Date: Fri, 14 Aug 2026 21:26:08 +0000 (-0700) Subject: Add confirmed block from problematic account to check verification aligns with Nano... X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=16e0c54f8cd662a8f8bf7baa925f1450230e0cb6;p=nano25519.git Add confirmed block from problematic account to check verification aligns with Nano node implementation, which it currently does not. --- diff --git a/test.mjs b/test.mjs index a9c7cd5..93c4ac4 100644 --- a/test.mjs +++ b/test.mjs @@ -2,9 +2,9 @@ //! SPDX-License-Identifier: GPL-3.0-or-later import * as Nano25519 from 'nano25519' -import { derive, sign, verify } from 'nano25519/sync' import { deriveAsync, signAsync, verifyAsync } from 'nano25519/async' -import { NANO_ORG_VECTOR, PYTHON_ED25519_BLAKE2B_VECTORS } from './vectors.mjs' +import { derive, sign, verify } from 'nano25519/sync' +import { NANO_ORG_VECTOR, PROBLEM_VECTOR, PYTHON_ED25519_BLAKE2B_VECTORS } from './vectors.mjs' /** * @param {string} name @@ -187,6 +187,13 @@ check(`sign message too long (65538 '1's)`, test) passes += +test failures += +!test +// Check verification of cemented block from non-canonical account +result = verify(PROBLEM_VECTOR.signature, PROBLEM_VECTOR.blockHash, PROBLEM_VECTOR.publicKey) +test = result === true +check(`verify problematic signature string ${NANO_ORG_VECTOR.signature}`, test) +passes += +test +failures += +!test + // Check output buffer offset handling try { outbuf = new Uint8Array(33) diff --git a/vectors.mjs b/vectors.mjs index 946f908..380b477 100644 --- a/vectors.mjs +++ b/vectors.mjs @@ -14,7 +14,15 @@ export const NANO_ORG_VECTOR = { signature: '74BCC59DBA39A1E34A5F75F96D6DE9154E3477AAD7DE30EA563DFCFE501A804228008F98DDF4A15FD35705102785C50EF76732C3A74B0FEC5B0DD67B574A5900', signatureBytes: new Uint8Array([0x74, 0xBC, 0xC5, 0x9D, 0xBA, 0x39, 0xA1, 0xE3, 0x4A, 0x5F, 0x75, 0xF9, 0x6D, 0x6D, 0xE9, 0x15, 0x4E, 0x34, 0x77, 0xAA, 0xD7, 0xDE, 0x30, 0xEA, 0x56, 0x3D, 0xFC, 0xFE, 0x50, 0x1A, 0x80, 0x42, 0x28, 0x00, 0x8F, 0x98, 0xDD, 0xF4, 0xA1, 0x5F, 0xD3, 0x57, 0x05, 0x10, 0x27, 0x85, 0xC5, 0x0E, 0xF7, 0x67, 0x32, 0xC3, 0xA7, 0x4B, 0x0F, 0xEC, 0x5B, 0x0D, 0xD6, 0x7B, 0x57, 0x4A, 0x59, 0x00]), badSignature: '74BCC59DBA39A1E34A5F75F96D6DE9154E3477AAD7DE30EA563DFCFE501A804215d484f5f757b4b7a9f4fcb2057fa423f76732c3a74b0fec5b0dd67b574a5910', - invalidMessageLength: 'BB569136FA05F8CBF65CEF2EDE368475B289C4477342976556BA4C0DDF216E450' + invalidMessageLength: 'BB569136FA05F8CBF65CEF2EDE368475B289C4477342976556BA4C0DDF216E450', +} + +// https://github.com/rsnano-node/rsnano-node/blob/develop/types/src/private_key.rs +// Address: nano_11a11111111111111111111111111111111111111111111111116iq5p4i8 +export const PROBLEM_VECTOR = { + blockHash: '150AFD70BD1E9845715F91D7CD7D5EE2683668199F19B4DF533FC7802CE07CA2', + publicKey: '0100000000000000000000000000000000000000000000000000000000000000', + signature: '1A8CFB63796525E47EBAF0B8696D95E2B893CBCC13454CB34530A59A3725C1A9FEA02A1F072BADE964BE5378CFA5AD50E743F167987444B1C9E3D7B3E6009F07', } /**