From 7b543e37fe68c21e6dfff6200995e034e34435e3 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Tue, 1 Dec 2020 15:13:58 -0500 Subject: [PATCH 01/13] wip: adding agent inject feature --- src/api/admin.ts | 6 ++++ src/websocket/admin.ts | 2 ++ test/e2e/fixture/test-config-1.yml | 7 ++++ test/e2e/index.ts | 57 ++++++++++++++++++++++++++++-- test/e2e/util.ts | 18 +++++----- 5 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 test/e2e/fixture/test-config-1.yml diff --git a/src/api/admin.ts b/src/api/admin.ts index 906a65a6..2ac23de8 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -32,6 +32,11 @@ export type ListCellIdsResponse = Array export type ListActiveAppsRequest = void export type ListActiveAppsResponse = Array +export type AgentInfoSigned = any + +export type RequestAgentInfoRequest = { cell_id: CellId|null } +export type RequestAgentInfoResponse = Array + export interface AdminApi { activateApp: Requester attachAppInterface: Requester @@ -42,6 +47,7 @@ export interface AdminApi { listDnas: Requester listCellIds: Requester listActiveApps: Requester + requestAgentInfo: Requester } diff --git a/src/websocket/admin.ts b/src/websocket/admin.ts index 6e333212..4a09adeb 100644 --- a/src/websocket/admin.ts +++ b/src/websocket/admin.ts @@ -59,6 +59,8 @@ export class AdminWebsocket implements Api.AdminApi { = this._requester('list_cell_ids') listActiveApps: Requester = this._requester('list_active_apps') + requestAgentInfo: Requester + = this._requester('request_agent_info') } diff --git a/test/e2e/fixture/test-config-1.yml b/test/e2e/fixture/test-config-1.yml new file mode 100644 index 00000000..07f5d1a6 --- /dev/null +++ b/test/e2e/fixture/test-config-1.yml @@ -0,0 +1,7 @@ +environment_path: /tmp/tmp.Awrd4WvLCK/holochain-test-Km9sFr +passphrase_service: + type: cmd +admin_interfaces: + - driver: + type: websocket + port: 33002 diff --git a/test/e2e/index.ts b/test/e2e/index.ts index dd39e56e..3ee625c0 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -1,13 +1,13 @@ - const test = require('tape') import { AdminWebsocket } from '../../src/websocket/admin' import { AppWebsocket } from '../../src/websocket/app' -import { installAppAndDna, withConductor } from './util' +import { installAppAndDna, withConductor, launch, CONFIG_PATH, CONFIG_PATH_1, FIXTURE_PATH } from './util' import { AgentPubKey, fakeAgentPubKey } from '../../src/api/types' import { AppSignal } from '../../src/api/app' const ADMIN_PORT = 33001 +const ADMIN_PORT_1 = 33002 const TEST_ZOME_NAME = 'foo' @@ -136,3 +136,56 @@ test('error is catchable when holochain socket is unavailable', async (t) => { ) } }) + + +test('can inject agents', async (t) => { + const conductor1 = await launch(ADMIN_PORT, CONFIG_PATH) + const conductor2 = await launch(ADMIN_PORT_1, CONFIG_PATH_1) + try { + const installed_app_id = 'app' + + const admin1 = await AdminWebsocket.connect(`http://localhost:${ADMIN_PORT}`) + const admin2 = await AdminWebsocket.connect(`http://localhost:${ADMIN_PORT_1}`) + + const agent_key_1 = await admin1.generateAgentPubKey() + t.ok(agent_key_1) + + const agent_key_2 = await admin2.generateAgentPubKey() + t.ok(agent_key_2) + + const nick = 'thedna' + let result = await admin1.installApp({ + installed_app_id, agent_key: agent_key_1, dnas: [ + { + path: `${FIXTURE_PATH}/test.dna.gz`, + nick, + } + ] + }) + t.ok(result) + + const app1_cell = result.cell_data[0][0] + result = await admin2.installApp({ + installed_app_id, agent_key: agent_key_2, dnas: [ + { + path: `${FIXTURE_PATH}/test.dna.gz`, + nick, + } + ] + }) + t.ok(result) + + const app2_cell = result.cell_data[0][0] + + const app1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); + console.log("FISH", app1_agentInfo) + t.equal(1,0) + t.ok(app1_agentInfo) + + } + finally { + conductor1.kill() + conductor2.kill() + } + +}) diff --git a/test/e2e/util.ts b/test/e2e/util.ts index a629a76f..fe229b33 100644 --- a/test/e2e/util.ts +++ b/test/e2e/util.ts @@ -5,9 +5,11 @@ import { InstalledAppId, CellId, CellNick } from '../../src/api/types' import { AppWebsocket } from '../../src/websocket/app' import { AdminWebsocket } from '../../src/websocket/admin' import yaml from 'js-yaml' -const CONFIG_PATH = './test/e2e/fixture/test-config.yml' +export const FIXTURE_PATH = './test/e2e/fixture' +export const CONFIG_PATH = `${FIXTURE_PATH}/test-config.yml` +export const CONFIG_PATH_1 = `${FIXTURE_PATH}/test-config-1.yml` -const writeConfig = (port) => { +const writeConfig = (port, configPath) => { const dir = fs.mkdtempSync(`${os.tmpdir()}/holochain-test-`) let yamlStr = yaml.safeDump({ @@ -22,7 +24,7 @@ const writeConfig = (port) => { } }] }); - fs.writeFileSync(CONFIG_PATH, yamlStr, 'utf8'); + fs.writeFileSync(configPath, yamlStr, 'utf8'); console.info(`using LMDB environment path: ${dir}`) } @@ -49,9 +51,9 @@ const awaitInterfaceReady = (handle): Promise => new Promise((fulfill, rej const HOLOCHAIN_BIN = 'holochain' -const launch = async (port) => { - await writeConfig(port) - const handle = spawn(HOLOCHAIN_BIN, ['-c', CONFIG_PATH]) +export const launch = async (port, configPath) => { + await writeConfig(port, configPath) + const handle = spawn(HOLOCHAIN_BIN, ['-c', configPath]) handle.stdout.on('data', data => { console.info('conductor: ', data.toString('utf8')) }) @@ -63,7 +65,7 @@ const launch = async (port) => { } export const withConductor = (port, f) => async t => { - const handle = await launch(port) + const handle = await launch(port, CONFIG_PATH) try { await f(t) } catch (e) { @@ -89,7 +91,7 @@ export const installAppAndDna = async ( agent_key: agent, dnas: [ { - path: 'test/e2e/fixture/test.dna.gz', + path: `${FIXTURE_PATH}/test.dna.gz`, nick, }, ], From 271a8bf9b8c1334433a247317f81ce2f3194e536 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Tue, 1 Dec 2020 15:21:10 -0500 Subject: [PATCH 02/13] wip --- test/e2e/fixture/.gitignore | 1 + test/e2e/fixture/test-config-1.yml | 7 ------- test/e2e/index.ts | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 test/e2e/fixture/test-config-1.yml diff --git a/test/e2e/fixture/.gitignore b/test/e2e/fixture/.gitignore index 3f7542fc..2228cc53 100644 --- a/test/e2e/fixture/.gitignore +++ b/test/e2e/fixture/.gitignore @@ -1,3 +1,4 @@ *.dna.gz test-config.yml +test-config-1.yml zomes/foo/target diff --git a/test/e2e/fixture/test-config-1.yml b/test/e2e/fixture/test-config-1.yml deleted file mode 100644 index 07f5d1a6..00000000 --- a/test/e2e/fixture/test-config-1.yml +++ /dev/null @@ -1,7 +0,0 @@ -environment_path: /tmp/tmp.Awrd4WvLCK/holochain-test-Km9sFr -passphrase_service: - type: cmd -admin_interfaces: - - driver: - type: websocket - port: 33002 diff --git a/test/e2e/index.ts b/test/e2e/index.ts index 3ee625c0..de0e0bb5 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -178,7 +178,7 @@ test('can inject agents', async (t) => { const app2_cell = result.cell_data[0][0] const app1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); - console.log("FISH", app1_agentInfo) + console.log("WHY IS THIS AN EMPTY ARRAY?", app1_agentInfo) t.equal(1,0) t.ok(app1_agentInfo) From 8041783a589abc15689f6632cd2bfd6ef0f6c229 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Tue, 1 Dec 2020 17:14:51 -0500 Subject: [PATCH 03/13] fixed --- test/e2e/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/e2e/index.ts b/test/e2e/index.ts index de0e0bb5..6196048a 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -176,10 +176,13 @@ test('can inject agents', async (t) => { t.ok(result) const app2_cell = result.cell_data[0][0] + console.log("app1_cell", app1_cell); + console.log("agent1_key", agent_key_1); + + await admin1.activateApp({ installed_app_id }) const app1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); - console.log("WHY IS THIS AN EMPTY ARRAY?", app1_agentInfo) - t.equal(1,0) + t.equal(app1_agentInfo.length, 1) t.ok(app1_agentInfo) } From e42223a4d06d247df09b2756a5ca42683ae446db Mon Sep 17 00:00:00 2001 From: Philip Beadle Date: Wed, 2 Dec 2020 09:22:49 +1100 Subject: [PATCH 04/13] Now has requestAgentInfo --- test/e2e/index.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/e2e/index.ts b/test/e2e/index.ts index 6196048a..c9870ceb 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -143,16 +143,12 @@ test('can inject agents', async (t) => { const conductor2 = await launch(ADMIN_PORT_1, CONFIG_PATH_1) try { const installed_app_id = 'app' - const admin1 = await AdminWebsocket.connect(`http://localhost:${ADMIN_PORT}`) const admin2 = await AdminWebsocket.connect(`http://localhost:${ADMIN_PORT_1}`) - const agent_key_1 = await admin1.generateAgentPubKey() t.ok(agent_key_1) - const agent_key_2 = await admin2.generateAgentPubKey() t.ok(agent_key_2) - const nick = 'thedna' let result = await admin1.installApp({ installed_app_id, agent_key: agent_key_1, dnas: [ @@ -163,8 +159,9 @@ test('can inject agents', async (t) => { ] }) t.ok(result) - const app1_cell = result.cell_data[0][0] + await admin1.activateApp({ installed_app_id }) + result = await admin2.installApp({ installed_app_id, agent_key: agent_key_2, dnas: [ { @@ -174,17 +171,18 @@ test('can inject agents', async (t) => { ] }) t.ok(result) - const app2_cell = result.cell_data[0][0] - console.log("app1_cell", app1_cell); - console.log("agent1_key", agent_key_1); + await admin2.activateApp({ installed_app_id }) - await admin1.activateApp({ installed_app_id }) + const conductor1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); + t.equal(conductor1_agentInfo.length, 1) + const conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfo.length, 1) - const app1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); + const app1_agentInfo = await admin1.requestAgentInfo({cell_id: app1_cell}); t.equal(app1_agentInfo.length, 1) - t.ok(app1_agentInfo) - + const app2_agentInfo = await admin2.requestAgentInfo({cell_id: app2_cell}); + t.equal(app2_agentInfo.length, 1) } finally { conductor1.kill() From 94204ffb9980f9cfa9b86247efb4b3af9c0ec063 Mon Sep 17 00:00:00 2001 From: Philip Beadle Date: Wed, 2 Dec 2020 10:02:00 +1100 Subject: [PATCH 05/13] Now injects agents into other conductors --- src/api/admin.ts | 3 +++ src/websocket/admin.ts | 2 ++ test/e2e/index.ts | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/api/admin.ts b/src/api/admin.ts index 2ac23de8..20c49469 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -36,6 +36,8 @@ export type AgentInfoSigned = any export type RequestAgentInfoRequest = { cell_id: CellId|null } export type RequestAgentInfoResponse = Array +export type AddAgentInfoRequest = { agent_infos: Array } +export type AddAgentInfoResponse = any export interface AdminApi { activateApp: Requester @@ -48,6 +50,7 @@ export interface AdminApi { listCellIds: Requester listActiveApps: Requester requestAgentInfo: Requester + addAgentInfo: Requester } diff --git a/src/websocket/admin.ts b/src/websocket/admin.ts index 4a09adeb..bd0675e5 100644 --- a/src/websocket/admin.ts +++ b/src/websocket/admin.ts @@ -61,6 +61,8 @@ export class AdminWebsocket implements Api.AdminApi { = this._requester('list_active_apps') requestAgentInfo: Requester = this._requester('request_agent_info') + addAgentInfo: Requester + = this._requester('add_agent_info') } diff --git a/test/e2e/index.ts b/test/e2e/index.ts index c9870ceb..9993f68c 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -183,6 +183,10 @@ test('can inject agents', async (t) => { t.equal(app1_agentInfo.length, 1) const app2_agentInfo = await admin2.requestAgentInfo({cell_id: app2_cell}); t.equal(app2_agentInfo.length, 1) + + await admin1.addAgentInfo({ agent_infos: conductor2_agentInfo }); + const conductor1_agentInfo_again = await admin1.requestAgentInfo({cell_id: null}); + t.equal(conductor1_agentInfo_again.length, 2) } finally { conductor1.kill() From 1ea94ef207a850b27863e09208e85dcb0a9c359d Mon Sep 17 00:00:00 2001 From: Philip Beadle Date: Wed, 2 Dec 2020 10:06:32 +1100 Subject: [PATCH 06/13] Bump version for publishing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef960e00..bfe3212c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@holochain/conductor-api", - "version": "0.0.1-dev.13", + "version": "0.0.1-dev.14", "description": "Encode/decode messages to/from the Holochain Conductor API over Websocket", "repository": { "type": "git", From d57bba2149398f38fec20c9a063dbd7dc5d66c7b Mon Sep 17 00:00:00 2001 From: Philip Beadle Date: Wed, 2 Dec 2020 10:32:57 +1100 Subject: [PATCH 07/13] Checking that we can get just the newly installed agent/app to push to other conductors --- package-lock.json | 2 +- test/e2e/index.ts | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 109e2d82..0d59499b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@holochain/conductor-api", - "version": "0.0.1-dev.13", + "version": "0.0.1-dev.14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/e2e/index.ts b/test/e2e/index.ts index 9993f68c..b8db3bf8 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -161,6 +161,12 @@ test('can inject agents', async (t) => { t.ok(result) const app1_cell = result.cell_data[0][0] await admin1.activateApp({ installed_app_id }) + const conductor1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); + t.equal(conductor1_agentInfo.length, 1) + + await admin2.addAgentInfo({ agent_infos: conductor1_agentInfo }); + const conductor2_agentInfo_again = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfo_again.length, 1) result = await admin2.installApp({ installed_app_id, agent_key: agent_key_2, dnas: [ @@ -174,19 +180,15 @@ test('can inject agents', async (t) => { const app2_cell = result.cell_data[0][0] await admin2.activateApp({ installed_app_id }) - const conductor1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); - t.equal(conductor1_agentInfo.length, 1) - const conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); - t.equal(conductor2_agentInfo.length, 1) + const conductor2_agentInfos = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfos.length, 2) + await admin1.addAgentInfo({ agent_infos: conductor2_agentInfos }); const app1_agentInfo = await admin1.requestAgentInfo({cell_id: app1_cell}); t.equal(app1_agentInfo.length, 1) const app2_agentInfo = await admin2.requestAgentInfo({cell_id: app2_cell}); t.equal(app2_agentInfo.length, 1) - await admin1.addAgentInfo({ agent_infos: conductor2_agentInfo }); - const conductor1_agentInfo_again = await admin1.requestAgentInfo({cell_id: null}); - t.equal(conductor1_agentInfo_again.length, 2) } finally { conductor1.kill() From 69bbda62aa26066b745e00ebfbec28dcd84d1730 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Fri, 4 Dec 2020 15:19:25 -0500 Subject: [PATCH 08/13] placeholder type for AgentInfoSigned --- src/api/admin.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/api/admin.ts b/src/api/admin.ts index 20c49469..a6954284 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -32,7 +32,11 @@ export type ListCellIdsResponse = Array export type ListActiveAppsRequest = void export type ListActiveAppsResponse = Array -export type AgentInfoSigned = any +export type AgentInfoSigned = { + agent: AgentPubKey, + signature: any, // don't yet have a type for signatures + agent_info: any, // don't yet have a type for agent_info +} export type RequestAgentInfoRequest = { cell_id: CellId|null } export type RequestAgentInfoResponse = Array From 43770c2b87d61752da0c4eccfe71f6249f97b641 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Fri, 4 Dec 2020 15:25:12 -0500 Subject: [PATCH 09/13] comment and clean up test --- test/e2e/index.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/e2e/index.ts b/test/e2e/index.ts index b8db3bf8..82279a21 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -161,13 +161,20 @@ test('can inject agents', async (t) => { t.ok(result) const app1_cell = result.cell_data[0][0] await admin1.activateApp({ installed_app_id }) + // after activating an app requestAgentInfo should return the agentid const conductor1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); t.equal(conductor1_agentInfo.length, 1) - + + // agent2 with no activated apps there are no agents + var conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfo.length, 0) + + // but, after explicitly injecting an agent, we should see it await admin2.addAgentInfo({ agent_infos: conductor1_agentInfo }); - const conductor2_agentInfo_again = await admin2.requestAgentInfo({cell_id: null}); - t.equal(conductor2_agentInfo_again.length, 1) + conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfo.length, 1) + // now install the app and activate it on agent 2. result = await admin2.installApp({ installed_app_id, agent_key: agent_key_2, dnas: [ { @@ -179,11 +186,11 @@ test('can inject agents', async (t) => { t.ok(result) const app2_cell = result.cell_data[0][0] await admin2.activateApp({ installed_app_id }) + // observe 2 agent infos + conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); + t.equal(conductor2_agentInfo.length, 2) - const conductor2_agentInfos = await admin2.requestAgentInfo({cell_id: null}); - t.equal(conductor2_agentInfos.length, 2) - - await admin1.addAgentInfo({ agent_infos: conductor2_agentInfos }); + await admin1.addAgentInfo({ agent_infos: conductor2_agentInfo }); const app1_agentInfo = await admin1.requestAgentInfo({cell_id: app1_cell}); t.equal(app1_agentInfo.length, 1) const app2_agentInfo = await admin2.requestAgentInfo({cell_id: app2_cell}); From dec9231e54f23a69692afb41ba54a8a19688a881 Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Fri, 4 Dec 2020 15:27:48 -0500 Subject: [PATCH 10/13] more comments --- test/e2e/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/e2e/index.ts b/test/e2e/index.ts index 82279a21..81a5b8dd 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -162,6 +162,8 @@ test('can inject agents', async (t) => { const app1_cell = result.cell_data[0][0] await admin1.activateApp({ installed_app_id }) // after activating an app requestAgentInfo should return the agentid + // requesting info with null cell_id should return all agents known about. + // otherwise it's just agents know about for that cell const conductor1_agentInfo = await admin1.requestAgentInfo({cell_id: null}); t.equal(conductor1_agentInfo.length, 1) @@ -190,6 +192,7 @@ test('can inject agents', async (t) => { conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); t.equal(conductor2_agentInfo.length, 2) + // now confirm that we can ask for just one cell await admin1.addAgentInfo({ agent_infos: conductor2_agentInfo }); const app1_agentInfo = await admin1.requestAgentInfo({cell_id: app1_cell}); t.equal(app1_agentInfo.length, 1) From 3632f54c635b722c98c5613f90358cb30a61442d Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Fri, 4 Dec 2020 18:29:50 -0500 Subject: [PATCH 11/13] update holochain rev in test fixture --- test/e2e/fixture/zomes/foo/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/fixture/zomes/foo/Cargo.toml b/test/e2e/fixture/zomes/foo/Cargo.toml index 3f35e8e9..d132b1a0 100644 --- a/test/e2e/fixture/zomes/foo/Cargo.toml +++ b/test/e2e/fixture/zomes/foo/Cargo.toml @@ -10,4 +10,4 @@ crate-type = [ "cdylib", "rlib" ] [dependencies] serde = "=1.0.104" -hdk3 = { git = "https://github.com/holochain/holochain", rev = "2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f", package = "hdk3" } +hdk3 = { git = "https://github.com/holochain/holochain", rev = "b337f81080d35821344d7565778d8e70e2947a92", package = "hdk3" } From 4bc54c77e536d1b6470c26fa95ed299d86b9a83d Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Fri, 4 Dec 2020 18:33:54 -0500 Subject: [PATCH 12/13] more holochain rev updates --- README.md | 6 +++--- install-holochain.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 74ad8896..72bf20eb 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,17 @@ npm install --save-exact @holochain/conductor-api This version of `holochain-conductor-api` is currently working with `holochain/holochain` at commit: -[2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f](https://github.com/holochain/holochain/commit/2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f) (Nov 16, 2020) +[b337f81080d35821344d7565778d8e70e2947a92](https://github.com/holochain/holochain/commit/b337f81080d35821344d7565778d8e70e2947a92) (Dec 4, 2020) If updating this code, please make changes to the git `rev/sha` in 3 places: 1. Here in the README above ^^ 2. This line in `install-holochain.sh` ```bash -REV=2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f +REV=b337f81080d35821344d7565778d8e70e2947a92 ``` 3. and this line in `test/e2e/fixtures/zomes/foo/Cargo.toml` ``` -hdk3 = { git = "https://github.com/holochain/holochain", rev = "2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f", package = "hdk3" } +hdk3 = { git = "https://github.com/holochain/holochain", rev = "b337f81080d35821344d7565778d8e70e2947a92", package = "hdk3" } ``` Notice the match between the SHA in both cases. These should always match. diff --git a/install-holochain.sh b/install-holochain.sh index 4832d84f..0b4dd5c1 100755 --- a/install-holochain.sh +++ b/install-holochain.sh @@ -1,6 +1,6 @@ #!/bin/bash -REV=2dfe85db10a5d9ba3ee25ff33f4bedb1a28f875f +REV=b337f81080d35821344d7565778d8e70e2947a92 cargo install --force holochain \ --git https://github.com/holochain/holochain.git \ From 49a43718c146f2bf8f65281d48efce4959844b0d Mon Sep 17 00:00:00 2001 From: Eric Harris-Braun Date: Sat, 5 Dec 2020 08:43:59 -0500 Subject: [PATCH 13/13] make AgentInfoSigned opaque and confirm equality in test --- src/api/admin.ts | 12 +++++++----- test/e2e/index.ts | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/api/admin.ts b/src/api/admin.ts index a6954284..2f8ede44 100644 --- a/src/api/admin.ts +++ b/src/api/admin.ts @@ -32,11 +32,13 @@ export type ListCellIdsResponse = Array export type ListActiveAppsRequest = void export type ListActiveAppsResponse = Array -export type AgentInfoSigned = { - agent: AgentPubKey, - signature: any, // don't yet have a type for signatures - agent_info: any, // don't yet have a type for agent_info -} +// this type is meant to be opaque +export type AgentInfoSigned = any +/*{ + agent: any, + signature: any, + agent_info: any, +}*/ export type RequestAgentInfoRequest = { cell_id: CellId|null } export type RequestAgentInfoResponse = Array diff --git a/test/e2e/index.ts b/test/e2e/index.ts index 81a5b8dd..333c9840 100644 --- a/test/e2e/index.ts +++ b/test/e2e/index.ts @@ -175,6 +175,7 @@ test('can inject agents', async (t) => { await admin2.addAgentInfo({ agent_infos: conductor1_agentInfo }); conductor2_agentInfo = await admin2.requestAgentInfo({cell_id: null}); t.equal(conductor2_agentInfo.length, 1) + t.deepEqual(conductor1_agentInfo,conductor2_agentInfo) // now install the app and activate it on agent 2. result = await admin2.installApp({