From 9f881f10c152966033590dd39c62c6557923bfde Mon Sep 17 00:00:00 2001 From: "Michael(KvngMikey)" Date: Mon, 24 Aug 2026 13:12:48 +0100 Subject: [PATCH] test(integration): accept nutshell's post-#1008 p2pk witness error Two integration cases pinned the pre-#1008 shape of nutshell's "missing P2PK witness" rejection, so they failed against a mint built from current nutshell main while still passing against cashubtc/nutshell:0.20.3. Nutshell #1008 replaced a bare assert in Proof.p2pksigs -- whose AssertionError leaked through the exception handler as code 0 -- with a real TransactionError (11000). That is the mint fixing a leak, so widen both assertions to span the old and new forms rather than swapping one for the other: cashu-ts has to work against released and current mints. "witness could not be parsed." (new in nutshell #1130) is deliberately not accepted. These cases send no witness at all, so reporting a parse failure would be a real regression and should still fail here. Closes #991 --- test/integration.test.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/integration.test.ts b/test/integration.test.ts index 42957354f..f022c8cbe 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -340,8 +340,12 @@ describe('mint api', () => { expect(result).toBeInstanceOf(MintOperationError); const e = result as MintOperationError; expect(e.name).toBe('MintOperationError'); - expect([0, 20008]).toContain(e.code); // nutshell + cdk - expect(e.message.toLowerCase()).toMatch(/witness.*p2pk.*signature/); // nutshell + cdk + // nutshell + cdk. Nutshell reports a missing witness differently since #1008 + // reworked SIG_ALL/P2PK: <=0.20.3 leaks an AssertionError as code 0 with + // "Witness is missing for p2pk signature"; current main raises TransactionError + // (11000) with "no signatures in proof." + expect([0, 11000, 20008]).toContain(e.code); + expect(e.message.toLowerCase()).toMatch(/witness.*p2pk.*signature|no signatures in proof/); // Try and receive them with Bob's secret key (should suceed) const proofs = await wallet.receive(encoded, { privkey: bytesToHex(privKeyBob) }); expect(sumProofs(proofs).equals(63)).toBeTruthy(); @@ -371,7 +375,10 @@ describe('mint api', () => { const e = result as MintOperationError; expect(e.name).toBe('MintOperationError'); expect([11000, 20008]).toContain(e.code); // nutshell + cdk - expect(e.message.toLowerCase()).toMatch(/no witness|signatures not provided/); // nutshell + cdk + // "no witness in proof." became "no signatures in proof." in nutshell #1008. + expect(e.message.toLowerCase()).toMatch( + /no witness|no signatures in proof|signatures not provided/, + ); // nutshell + cdk // Try and receive them with Bob's secret key (should suceed) const { keep } = await wallet.completeSwap(txn, bytesToHex(privKeyBob)); expect(sumProofs(keep).equals(64)).toBeTruthy();