From e280c8ed5376686bb9bdc13b510d0c229f0a4822 Mon Sep 17 00:00:00 2001 From: JettTech Date: Fri, 23 Aug 2024 18:59:45 -0500 Subject: [PATCH 1/4] make compatibile with signal changes and pubkey as optional --- docs/tryorama.appoptions.md | 2 +- docs/tryorama.appoptions.signalhandler.md | 2 +- docs/tryorama.clientsplayersoptions.md | 2 +- ...rama.clientsplayersoptions.signalhandler.md | 2 +- docs/tryorama.getcallablecell.md | 4 ++-- docs/tryorama.trycpclient.setsignalhandler.md | 4 ++-- docs/tryorama.trycpconductor.on.md | 4 ++-- ts/src/local/conductor.ts | 12 +++++++----- ts/src/trycp/conductor/conductor.ts | 4 ++-- ts/src/trycp/conductor/scenario.ts | 4 ++-- ts/src/trycp/trycp-client.ts | 6 +++--- ts/src/trycp/util.ts | 8 ++++---- ts/src/types.ts | 4 ++-- ts/test/local/conductor.ts | 10 +++++----- ts/test/local/scenario.ts | 18 +++++++++--------- ts/test/trycp/conductor.ts | 5 +++-- ts/test/trycp/scenario.ts | 10 +++++----- 17 files changed, 52 insertions(+), 49 deletions(-) diff --git a/docs/tryorama.appoptions.md b/docs/tryorama.appoptions.md index 33f430da..7f1345b9 100644 --- a/docs/tryorama.appoptions.md +++ b/docs/tryorama.appoptions.md @@ -121,7 +121,7 @@ _(Optional)_ A network seed to override the hApps' network seed. -AppSignalCb +SignalCb diff --git a/docs/tryorama.appoptions.signalhandler.md b/docs/tryorama.appoptions.signalhandler.md index 64094b84..395a2486 100644 --- a/docs/tryorama.appoptions.signalhandler.md +++ b/docs/tryorama.appoptions.signalhandler.md @@ -9,5 +9,5 @@ A signal handler for the conductor. **Signature:** ```typescript -signalHandler?: AppSignalCb; +signalHandler?: SignalCb; ``` diff --git a/docs/tryorama.clientsplayersoptions.md b/docs/tryorama.clientsplayersoptions.md index d3657460..0931784c 100644 --- a/docs/tryorama.clientsplayersoptions.md +++ b/docs/tryorama.clientsplayersoptions.md @@ -158,7 +158,7 @@ _(Optional)_ Configuration for the conductor (optional). -AppSignalCb +SignalCb diff --git a/docs/tryorama.clientsplayersoptions.signalhandler.md b/docs/tryorama.clientsplayersoptions.signalhandler.md index 483033b2..70e75791 100644 --- a/docs/tryorama.clientsplayersoptions.signalhandler.md +++ b/docs/tryorama.clientsplayersoptions.signalhandler.md @@ -9,5 +9,5 @@ A signal handler to be registered in conductors. **Signature:** ```typescript -signalHandler?: AppSignalCb; +signalHandler?: SignalCb; ``` diff --git a/docs/tryorama.getcallablecell.md b/docs/tryorama.getcallablecell.md index 20fc9ef1..7da7d6fa 100644 --- a/docs/tryorama.getcallablecell.md +++ b/docs/tryorama.getcallablecell.md @@ -13,7 +13,7 @@ getCallableCell: (appWs: IAppWebsocket, cell: ClonedCell | ProvisionedCell) => { callZome: (request: CellZomeCallRequest, timeout?: number) => Promise; cell_id: import("@holochain/client").CellId; clone_id: string; - original_dna_hash: import("@spartan-hc/holo-hash").DnaHash; + original_dna_hash: Uint8Array; dna_modifiers: import("@holochain/client").DnaModifiers; name: string; enabled: boolean; @@ -78,7 +78,7 @@ Cell to bind zome call function to. **Returns:** -{ callZome: <T>(request: [CellZomeCallRequest](./tryorama.cellzomecallrequest.md), timeout?: number) => Promise<T>; cell\_id: import("@holochain/client").CellId; clone\_id: string; original\_dna\_hash: import("@spartan-hc/holo-hash").DnaHash; dna\_modifiers: import("@holochain/client").DnaModifiers; name: string; enabled: boolean; } \| { callZome: <T>(request: [CellZomeCallRequest](./tryorama.cellzomecallrequest.md), timeout?: number) => Promise<T>; cell\_id: import("@holochain/client").CellId; dna\_modifiers: import("@holochain/client").DnaModifiers; name: string; } +{ callZome: <T>(request: [CellZomeCallRequest](./tryorama.cellzomecallrequest.md), timeout?: number) => Promise<T>; cell\_id: import("@holochain/client").CellId; clone\_id: string; original\_dna\_hash: Uint8Array; dna\_modifiers: import("@holochain/client").DnaModifiers; name: string; enabled: boolean; } \| { callZome: <T>(request: [CellZomeCallRequest](./tryorama.cellzomecallrequest.md), timeout?: number) => Promise<T>; cell\_id: import("@holochain/client").CellId; dna\_modifiers: import("@holochain/client").DnaModifiers; name: string; } A callable cell. diff --git a/docs/tryorama.trycpclient.setsignalhandler.md b/docs/tryorama.trycpclient.setsignalhandler.md index d4514ffa..f3fc79b9 100644 --- a/docs/tryorama.trycpclient.setsignalhandler.md +++ b/docs/tryorama.trycpclient.setsignalhandler.md @@ -7,7 +7,7 @@ **Signature:** ```typescript -setSignalHandler(port: number, signalHandler?: AppSignalCb): void; +setSignalHandler(port: number, signalHandler?: SignalCb): void; ``` ## Parameters @@ -49,7 +49,7 @@ signalHandler -AppSignalCb +SignalCb diff --git a/docs/tryorama.trycpconductor.on.md b/docs/tryorama.trycpconductor.on.md index 8b6c9e5c..aacf4569 100644 --- a/docs/tryorama.trycpconductor.on.md +++ b/docs/tryorama.trycpconductor.on.md @@ -9,7 +9,7 @@ Attach a signal handler. **Signature:** ```typescript -on(port: number, signalHandler: AppSignalCb): void; +on(port: number, signalHandler: SignalCb): void; ``` ## Parameters @@ -53,7 +53,7 @@ signalHandler -AppSignalCb +SignalCb diff --git a/ts/src/local/conductor.ts b/ts/src/local/conductor.ts index 571f93f8..159ea237 100644 --- a/ts/src/local/conductor.ts +++ b/ts/src/local/conductor.ts @@ -386,11 +386,13 @@ export class Conductor implements IConductor { installed_app_id, network_seed, }; - logger.debug( - `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( - agent_key - )}` - ); + if (!!agent_key) { + logger.debug( + `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( + agent_key + )}` + ); + } return this.adminWs().installApp(installAppRequest); } diff --git a/ts/src/trycp/conductor/conductor.ts b/ts/src/trycp/conductor/conductor.ts index 443d17a9..8f87eb8e 100644 --- a/ts/src/trycp/conductor/conductor.ts +++ b/ts/src/trycp/conductor/conductor.ts @@ -4,7 +4,7 @@ import { AgentPubKey, AppAuthenticationToken, AppBundleSource, - AppSignalCb, + SignalCb, AttachAppInterfaceRequest, CallZomeRequest, CallZomeRequestSigned, @@ -332,7 +332,7 @@ export class TryCpConductor implements IConductor { * @param signalHandler - The signal handler to register. * @param port - The port of the app interface. */ - on(port: number, signalHandler: AppSignalCb) { + on(port: number, signalHandler: SignalCb) { this.tryCpClient.setSignalHandler(port, signalHandler); } diff --git a/ts/src/trycp/conductor/scenario.ts b/ts/src/trycp/conductor/scenario.ts index d5797491..6ffa0e1e 100644 --- a/ts/src/trycp/conductor/scenario.ts +++ b/ts/src/trycp/conductor/scenario.ts @@ -1,4 +1,4 @@ -import { AgentPubKey, AppBundleSource, AppSignalCb } from "@holochain/client"; +import { AgentPubKey, AppBundleSource, SignalCb } from "@holochain/client"; import { ChildProcessWithoutNullStreams } from "node:child_process"; import { URL } from "url"; import { v4 as uuidv4 } from "uuid"; @@ -49,7 +49,7 @@ export interface ClientsPlayersOptions { /** * A signal handler to be registered in conductors. */ - signalHandler?: AppSignalCb; + signalHandler?: SignalCb; } /** diff --git a/ts/src/trycp/trycp-client.ts b/ts/src/trycp/trycp-client.ts index 47948cb2..39a41f7e 100644 --- a/ts/src/trycp/trycp-client.ts +++ b/ts/src/trycp/trycp-client.ts @@ -1,4 +1,4 @@ -import { AppSignalCb, CallZomeRequestSigned } from "@holochain/client"; +import { SignalCb, AppSignal, CallZomeRequestSigned } from "@holochain/client"; import msgpack from "@msgpack/msgpack"; import cloneDeep from "lodash/cloneDeep.js"; import assert from "node:assert"; @@ -46,7 +46,7 @@ export class TryCpClient { responseReject: (reason: TryCpResponseErrorValue) => void; }; }; - private signalHandlers: Record; + private signalHandlers: Record; // can be set in local test cases bootstrapServerUrl: URL | undefined; @@ -143,7 +143,7 @@ export class TryCpClient { return connectPromise; } - setSignalHandler(port: number, signalHandler?: AppSignalCb) { + setSignalHandler(port: number, signalHandler?: SignalCb) { this.signalHandlers[port] = signalHandler; } diff --git a/ts/src/trycp/util.ts b/ts/src/trycp/util.ts index 089dba05..d667d5b1 100644 --- a/ts/src/trycp/util.ts +++ b/ts/src/trycp/util.ts @@ -23,15 +23,15 @@ export const deserializeTryCpResponse = (response: Uint8Array) => { * @param signal - The signal to deserialize. * @returns The deserialized signal. */ -export const deserializeTryCpSignal = (signal: Uint8Array) => { +export const deserializeTryCpSignal = (signal: Uint8Array) => { const deserializedSignal = msgpack.decode(signal); assertIsSignal(deserializedSignal); if (SignalType.App in deserializedSignal) { const { - [SignalType.App]: { cell_id, signal: payload, zome_name }, + [SignalType.App]: { cell_id, payload: decodedPayload, zome_name }, } = deserializedSignal; - const decodedPayload = msgpack.decode(payload) as T; - return { cell_id, payload: decodedPayload, zome_name }; + let app_payload = { cell_id, payload: decodedPayload, zome_name }; + return { App: app_payload } as Signal } else { throw new Error("Receiving system signals is not implemented yet"); } diff --git a/ts/src/types.ts b/ts/src/types.ts index e25cf4bd..7a5181b4 100644 --- a/ts/src/types.ts +++ b/ts/src/types.ts @@ -4,7 +4,7 @@ import type { AppAuthenticationToken, AppBundleSource, AppInfo, - AppSignalCb, + SignalCb, AppWebsocket, CallZomeRequest, CellId, @@ -151,7 +151,7 @@ export interface AppOptions { /** * A signal handler for the conductor. */ - signalHandler?: AppSignalCb; + signalHandler?: SignalCb; } /** diff --git a/ts/test/local/conductor.ts b/ts/test/local/conductor.ts index 6955d7bc..4780a4c2 100644 --- a/ts/test/local/conductor.ts +++ b/ts/test/local/conductor.ts @@ -1,12 +1,12 @@ import { ActionHash, AppBundleSource, - AppSignal, - AppSignalCb, + Signal, + SignalCb, CellProvisioningStrategy, CloneId, EntryHash, - Signal, + AppSignal, SignalType, } from "@holochain/client"; import assert from "node:assert"; @@ -616,8 +616,8 @@ test("Local Conductor - create and read an entry, 2 conductors, 2 cells, 2 agent test("Local Conductor - Receive a signal", async (t) => { const { servicesProcess, signalingServerUrl } = await runLocalServices(); - let signalHandler: AppSignalCb | undefined; - const signalReceived = new Promise((resolve) => { + let signalHandler: SignalCb | undefined; + const signalReceived = new Promise((resolve) => { signalHandler = (signal: Signal) => { assert(SignalType.App in signal); resolve(signal[SignalType.App]); diff --git a/ts/test/local/scenario.ts b/ts/test/local/scenario.ts index 6ddd325e..9d397501 100644 --- a/ts/test/local/scenario.ts +++ b/ts/test/local/scenario.ts @@ -1,11 +1,11 @@ import { ActionHash, AppBundleSource, - AppSignal, - AppSignalCb, + Signal, + SignalCb, AppWebsocket, EntryHash, - Signal, + AppSignal, SignalType, } from "@holochain/client"; import assert from "node:assert/strict"; @@ -66,8 +66,8 @@ test("Local Scenario - runScenario - Catch error when calling a zome of an undef test("Local Scenario - runScenario - Catch error that occurs in a signal handler", async (t) => { await runScenario(async (scenario: Scenario) => { - let signalHandlerAlice: AppSignalCb | undefined; - const signalReceivedAlice = new Promise((_, reject) => { + let signalHandlerAlice: SignalCb | undefined; + const signalReceivedAlice = new Promise((_, reject) => { signalHandlerAlice = () => { reject(); }; @@ -201,16 +201,16 @@ test("Local Scenario - Conductor maintains data after shutdown and restart", asy test("Local Scenario - Receive signals with 2 conductors", async (t) => { const scenario = new Scenario(); - let signalHandlerAlice: AppSignalCb | undefined; - const signalReceivedAlice = new Promise((resolve) => { + let signalHandlerAlice: SignalCb | undefined; + const signalReceivedAlice = new Promise((resolve) => { signalHandlerAlice = (signal: Signal) => { assert(SignalType.App in signal); resolve(signal[SignalType.App]); }; }); - let signalHandlerBob: AppSignalCb | undefined; - const signalReceivedBob = new Promise((resolve) => { + let signalHandlerBob: SignalCb | undefined; + const signalReceivedBob = new Promise((resolve) => { signalHandlerBob = (signal: Signal) => { assert(SignalType.App in signal); resolve(signal[SignalType.App]); diff --git a/ts/test/trycp/conductor.ts b/ts/test/trycp/conductor.ts index eaaab8f1..cf400600 100644 --- a/ts/test/trycp/conductor.ts +++ b/ts/test/trycp/conductor.ts @@ -1,6 +1,7 @@ import { ActionHash, AppBundleSource, + Signal, AppSignal, CellProvisioningStrategy, CellType, @@ -395,8 +396,8 @@ test("TryCP Conductor - receive a signal", async (t) => { const testSignal = { value: "signal" }; let signalHandler; - const signalReceived = new Promise((resolve) => { - signalHandler = (signal: AppSignal) => { + const signalReceived = new Promise((resolve) => { + signalHandler = (signal: Signal) => { resolve(signal); }; }); diff --git a/ts/test/trycp/scenario.ts b/ts/test/trycp/scenario.ts index fbc2c0de..c34b45ae 100644 --- a/ts/test/trycp/scenario.ts +++ b/ts/test/trycp/scenario.ts @@ -1,4 +1,4 @@ -import { AppSignal, AppSignalCb, EntryHash } from "@holochain/client"; +import { Signal, SignalCb, EntryHash } from "@holochain/client"; import { URL } from "node:url"; import test from "tape-promise/tape.js"; import { runLocalServices } from "../../src/common.js"; @@ -152,14 +152,14 @@ test("TryCP Scenario - receive signals with 2 conductors", async (t) => { } = await runLocalServices()); const client = await scenario.addClient(SERVER_URL); - let signalHandlerAlice: AppSignalCb | undefined; - const signalReceivedAlice = new Promise((resolve) => { + let signalHandlerAlice: SignalCb | undefined; + const signalReceivedAlice = new Promise((resolve) => { signalHandlerAlice = (signal) => { resolve(signal); }; }); - let signalHandlerBob: AppSignalCb | undefined; - const signalReceivedBob = new Promise((resolve) => { + let signalHandlerBob: SignalCb | undefined; + const signalReceivedBob = new Promise((resolve) => { signalHandlerBob = (signal) => { resolve(signal); }; From 9cc3f8f09b538ac255b128e81c601100ec12e620 Mon Sep 17 00:00:00 2001 From: JettTech Date: Mon, 26 Aug 2024 03:10:25 -0500 Subject: [PATCH 2/4] fix types and tests --- ts/src/local/conductor.ts | 12 +++++------- ts/src/trycp/util.ts | 18 +++++++++++------- ts/test/trycp/conductor.ts | 3 ++- ts/test/trycp/scenario.ts | 8 +++++--- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/ts/src/local/conductor.ts b/ts/src/local/conductor.ts index 159ea237..571f93f8 100644 --- a/ts/src/local/conductor.ts +++ b/ts/src/local/conductor.ts @@ -386,13 +386,11 @@ export class Conductor implements IConductor { installed_app_id, network_seed, }; - if (!!agent_key) { - logger.debug( - `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( - agent_key - )}` - ); - } + logger.debug( + `installing app with id ${installed_app_id} for agent ${encodeHashToBase64( + agent_key + )}` + ); return this.adminWs().installApp(installAppRequest); } diff --git a/ts/src/trycp/util.ts b/ts/src/trycp/util.ts index d667d5b1..bd995031 100644 --- a/ts/src/trycp/util.ts +++ b/ts/src/trycp/util.ts @@ -1,7 +1,8 @@ -import { Signal, SignalType } from "@holochain/client"; +import { AppSignal, RawSignal, EncodedAppSignal, Signal, SignalType } from "@holochain/client"; import msgpack from "@msgpack/msgpack"; import assert from "node:assert"; import { TryCpApiResponse, _TryCpResponseWrapper } from "./types.js"; +import { inspect } from "util"; /** * Deserialize the binary response from TryCP @@ -24,14 +25,17 @@ export const deserializeTryCpResponse = (response: Uint8Array) => { * @returns The deserialized signal. */ export const deserializeTryCpSignal = (signal: Uint8Array) => { - const deserializedSignal = msgpack.decode(signal); + const deserializedSignal = msgpack.decode(signal) as RawSignal; assertIsSignal(deserializedSignal); if (SignalType.App in deserializedSignal) { - const { - [SignalType.App]: { cell_id, payload: decodedPayload, zome_name }, - } = deserializedSignal; - let app_payload = { cell_id, payload: decodedPayload, zome_name }; - return { App: app_payload } as Signal + const { cell_id, signal, zome_name } = deserializedSignal[SignalType.App] as EncodedAppSignal; + const decodedPayload = msgpack.decode(signal); + const app_signal: AppSignal = { + cell_id, + zome_name, + payload: decodedPayload, + }; + return { App: app_signal } as Signal; } else { throw new Error("Receiving system signals is not implemented yet"); } diff --git a/ts/test/trycp/conductor.ts b/ts/test/trycp/conductor.ts index cf400600..8f711758 100644 --- a/ts/test/trycp/conductor.ts +++ b/ts/test/trycp/conductor.ts @@ -8,6 +8,7 @@ import { CloneId, encodeHashToBase64, EntryHash, + SignalType, GrantedFunctionsType, } from "@holochain/client"; import assert from "node:assert"; @@ -433,7 +434,7 @@ test("TryCP Conductor - receive a signal", async (t) => { }); const actualSignal = await signalReceived; t.deepEqual( - actualSignal.payload, + actualSignal[SignalType.App].payload, testSignal, "received signal matches expected signal" ); diff --git a/ts/test/trycp/scenario.ts b/ts/test/trycp/scenario.ts index c34b45ae..cb5d14d0 100644 --- a/ts/test/trycp/scenario.ts +++ b/ts/test/trycp/scenario.ts @@ -1,4 +1,4 @@ -import { Signal, SignalCb, EntryHash } from "@holochain/client"; +import { Signal, SignalCb, EntryHash, SignalType } from "@holochain/client"; import { URL } from "node:url"; import test from "tape-promise/tape.js"; import { runLocalServices } from "../../src/common.js"; @@ -192,12 +192,14 @@ test("TryCP Scenario - receive signals with 2 conductors", async (t) => { signalReceivedAlice, signalReceivedBob, ]); + t.deepEqual( - actualSignalAlice.payload, + actualSignalAlice[SignalType.App].payload, signalAlice, "received alice's signal" ); - t.deepEqual(actualSignalBob.payload, signalBob, "received bob's signal"); + + t.deepEqual(actualSignalBob[SignalType.App].payload, signalBob, "received bob's signal"); await scenario.cleanUp(); await tryCpServer.stop(); From 903a2e5cf5fbaae927e0e4c121fddfd6d227e943 Mon Sep 17 00:00:00 2001 From: JettTech Date: Mon, 26 Aug 2024 04:22:35 -0500 Subject: [PATCH 3/4] assert type check --- ts/src/trycp/trycp-client.ts | 2 +- ts/src/trycp/util.ts | 16 +++++++++------- ts/test/local/conductor.ts | 1 - ts/test/local/scenario.ts | 1 - ts/test/trycp/scenario.ts | 6 +++++- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ts/src/trycp/trycp-client.ts b/ts/src/trycp/trycp-client.ts index 39a41f7e..d6cb4217 100644 --- a/ts/src/trycp/trycp-client.ts +++ b/ts/src/trycp/trycp-client.ts @@ -1,4 +1,4 @@ -import { SignalCb, AppSignal, CallZomeRequestSigned } from "@holochain/client"; +import { SignalCb, CallZomeRequestSigned } from "@holochain/client"; import msgpack from "@msgpack/msgpack"; import cloneDeep from "lodash/cloneDeep.js"; import assert from "node:assert"; diff --git a/ts/src/trycp/util.ts b/ts/src/trycp/util.ts index bd995031..9ade20b5 100644 --- a/ts/src/trycp/util.ts +++ b/ts/src/trycp/util.ts @@ -1,4 +1,4 @@ -import { AppSignal, RawSignal, EncodedAppSignal, Signal, SignalType } from "@holochain/client"; +import { AppSignal, RawSignal, Signal, SignalType } from "@holochain/client"; import msgpack from "@msgpack/msgpack"; import assert from "node:assert"; import { TryCpApiResponse, _TryCpResponseWrapper } from "./types.js"; @@ -24,12 +24,14 @@ export const deserializeTryCpResponse = (response: Uint8Array) => { * @param signal - The signal to deserialize. * @returns The deserialized signal. */ -export const deserializeTryCpSignal = (signal: Uint8Array) => { - const deserializedSignal = msgpack.decode(signal) as RawSignal; - assertIsSignal(deserializedSignal); +export const deserializeTryCpSignal = (signal: Uint8Array) => { + const deserializedSignal = msgpack.decode(signal); + assertIsRawSignal(deserializedSignal); if (SignalType.App in deserializedSignal) { - const { cell_id, signal, zome_name } = deserializedSignal[SignalType.App] as EncodedAppSignal; - const decodedPayload = msgpack.decode(signal); + const { + [SignalType.App]: { cell_id, signal, zome_name }, + } = deserializedSignal; + const decodedPayload = msgpack.decode(signal) as T; const app_signal: AppSignal = { cell_id, zome_name, @@ -89,7 +91,7 @@ function assertIsApiResponse( assert(response && typeof response === "object" && "type" in response); } -function assertIsSignal(signal: unknown): asserts signal is Signal { +function assertIsRawSignal(signal: unknown): asserts signal is RawSignal { assert( signal && typeof signal === "object" && diff --git a/ts/test/local/conductor.ts b/ts/test/local/conductor.ts index 4780a4c2..81cf59c7 100644 --- a/ts/test/local/conductor.ts +++ b/ts/test/local/conductor.ts @@ -6,7 +6,6 @@ import { CellProvisioningStrategy, CloneId, EntryHash, - AppSignal, SignalType, } from "@holochain/client"; import assert from "node:assert"; diff --git a/ts/test/local/scenario.ts b/ts/test/local/scenario.ts index 9d397501..a2be083c 100644 --- a/ts/test/local/scenario.ts +++ b/ts/test/local/scenario.ts @@ -5,7 +5,6 @@ import { SignalCb, AppWebsocket, EntryHash, - AppSignal, SignalType, } from "@holochain/client"; import assert from "node:assert/strict"; diff --git a/ts/test/trycp/scenario.ts b/ts/test/trycp/scenario.ts index cb5d14d0..f19c119f 100644 --- a/ts/test/trycp/scenario.ts +++ b/ts/test/trycp/scenario.ts @@ -199,7 +199,11 @@ test("TryCP Scenario - receive signals with 2 conductors", async (t) => { "received alice's signal" ); - t.deepEqual(actualSignalBob[SignalType.App].payload, signalBob, "received bob's signal"); + t.deepEqual( + actualSignalBob[SignalType.App].payload, + signalBob, + "received bob's signal" + ); await scenario.cleanUp(); await tryCpServer.stop(); From f94c472fdc1ce1c73506411f9a09cdd7a98fe1bb Mon Sep 17 00:00:00 2001 From: JettTech Date: Mon, 26 Aug 2024 04:23:27 -0500 Subject: [PATCH 4/4] lint --- ts/test/fixture/zomes/coordinator/src/lib.rs | 23 ++++++++------------ 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/ts/test/fixture/zomes/coordinator/src/lib.rs b/ts/test/fixture/zomes/coordinator/src/lib.rs index f1970bb2..a674d76c 100644 --- a/ts/test/fixture/zomes/coordinator/src/lib.rs +++ b/ts/test/fixture/zomes/coordinator/src/lib.rs @@ -44,7 +44,9 @@ fn signal_loopback(value: LoopBack) -> ExternResult<()> { } #[hdk_extern] -fn create_two_party_countersigning_session(with_other: AgentPubKey) -> ExternResult { +fn create_two_party_countersigning_session( + with_other: AgentPubKey, +) -> ExternResult { let my_agent_info = agent_info()?; let entry = Content("hello".to_string()); @@ -55,27 +57,22 @@ fn create_two_party_countersigning_session(with_other: AgentPubKey) -> ExternRes let request = PreflightRequest::try_new( entry_hash, vec![ - ( - my_agent_info.agent_initial_pubkey, - vec![], - ), + (my_agent_info.agent_initial_pubkey, vec![]), (with_other.clone(), vec![]), ], Vec::with_capacity(0), 0, true, session_times, - ActionBase::Create(CreateBase::new( - EntryTypesUnit::Content.try_into()?, - )), + ActionBase::Create(CreateBase::new(EntryTypesUnit::Content.try_into()?)), PreflightBytes(vec![]), ) - .map_err(|e| { - wasm_error!(WasmErrorInner::Guest(format!( + .map_err(|e| { + wasm_error!(WasmErrorInner::Guest(format!( "Failed to create countersigning request: {:?}", e ))) - })?; + })?; // Accept ours now and then Holochain should wait for the other party to join the session let my_acceptance = accept_countersigning_preflight_request(request.clone())?; @@ -97,9 +94,7 @@ fn create_two_party_countersigning_session(with_other: AgentPubKey) -> ExternRes fn accept_two_party(request: PreflightRequest) -> ExternResult { let my_accept = accept_countersigning_preflight_request(request)?; match my_accept { - PreflightRequestAcceptance::Accepted(response) => { - Ok(response) - } + PreflightRequestAcceptance::Accepted(response) => Ok(response), e => Err(wasm_error!(WasmErrorInner::Guest(format!( "Unexpected response: {:?}", e