From bb9280ad6b1601d5fa7e90c58e9d94d63521c88a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 8 May 2025 10:55:22 +0100 Subject: [PATCH] Write a log line when cancelling verification (#4828) ... in an attempt to figure out what might have caused a spurious cancellation today --- spec/unit/rust-crypto/verification.spec.ts | 9 +++- src/rust-crypto/rust-crypto.ts | 59 +++++++--------------- src/rust-crypto/verification.ts | 4 ++ 3 files changed, 29 insertions(+), 43 deletions(-) diff --git a/spec/unit/rust-crypto/verification.spec.ts b/spec/unit/rust-crypto/verification.spec.ts index 13e911830..1c67897e5 100644 --- a/spec/unit/rust-crypto/verification.spec.ts +++ b/spec/unit/rust-crypto/verification.spec.ts @@ -32,6 +32,7 @@ import { import { type OutgoingRequestProcessor } from "../../../src/rust-crypto/OutgoingRequestProcessor"; import { type IDeviceKeys } from "../../../src/@types/crypto"; import { EventType, MatrixEvent, MsgType } from "../../../src"; +import { logger } from "../../../src/logger.ts"; describe("VerificationRequest", () => { describe("pending", () => { @@ -147,6 +148,7 @@ describe("VerificationRequest", () => { methods, ); const aliceVerificationRequest = new RustVerificationRequest( + logger, aliceOlmMachine, innerVerificationRequest, aliceRequestLoop as unknown as OutgoingRequestProcessor, @@ -174,6 +176,7 @@ describe("VerificationRequest", () => { "$m.key.verification.request", )!; const bobVerificationRequest = new RustVerificationRequest( + logger, bobOlmMachine, bobInnerVerificationRequest, bobRequestLoop as unknown as OutgoingRequestProcessor, @@ -278,6 +281,7 @@ describe("VerificationRequest", () => { methods, ); const aliceVerificationRequest = new RustVerificationRequest( + logger, aliceOlmMachine, innerVerificationRequest, aliceRequestLoop as unknown as OutgoingRequestProcessor, @@ -305,6 +309,7 @@ describe("VerificationRequest", () => { "$m.key.verification.request", )!; const bobVerificationRequest = new RustVerificationRequest( + logger, bobOlmMachine, bobInnerVerificationRequest, bobRequestLoop as unknown as OutgoingRequestProcessor, @@ -392,6 +397,7 @@ describe("VerificationRequest", () => { methods, ); const aliceVerificationRequest = new RustVerificationRequest( + logger, aliceOlmMachine, innerVerificationRequest, aliceRequestLoop as unknown as OutgoingRequestProcessor, @@ -419,6 +425,7 @@ describe("VerificationRequest", () => { "$m.key.verification.request", )!; const bobVerificationRequest = new RustVerificationRequest( + logger, bobOlmMachine, bobInnerVerificationRequest, bobRequestLoop as unknown as OutgoingRequestProcessor, @@ -496,7 +503,7 @@ function makeTestRequest( inner ??= makeMockedInner(); olmMachine ??= {} as RustSdkCryptoJs.OlmMachine; outgoingRequestProcessor ??= {} as OutgoingRequestProcessor; - return new RustVerificationRequest(olmMachine, inner, outgoingRequestProcessor, []); + return new RustVerificationRequest(logger, olmMachine, inner, outgoingRequestProcessor, []); } /** Mock up a rust-side VerificationRequest */ diff --git a/src/rust-crypto/rust-crypto.ts b/src/rust-crypto/rust-crypto.ts index 4785fca02..c989e6cfd 100644 --- a/src/rust-crypto/rust-crypto.ts +++ b/src/rust-crypto/rust-crypto.ts @@ -969,15 +969,7 @@ export class RustCrypto extends TypedEventEmitter request.roomId === undefined) - .map( - (request) => - new RustVerificationRequest( - this.olmMachine, - request, - this.outgoingRequestProcessor, - this._supportedVerificationMethods, - ), - ); + .map((request) => this.makeVerificationRequest(request)); } /** @@ -1002,12 +994,7 @@ export class RustCrypto extends TypedEventEmitter request.roomId?.toString() === roomId); if (request) { - return new RustVerificationRequest( - this.olmMachine, - request, - this.outgoingRequestProcessor, - this._supportedVerificationMethods, - ); + return this.makeVerificationRequest(request); } } @@ -1038,12 +1025,7 @@ export class RustCrypto extends TypedEventEmitter