From 00bb38db6db13a396fdbdd9916818c8780673410 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Wed, 2 Sep 2020 17:40:34 +0200 Subject: [PATCH 1/7] fix(core): fix after updating to CID v1 --- .../ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts b/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts index 16949cdf8f..29a2b24830 100644 --- a/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts +++ b/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts @@ -160,7 +160,7 @@ export default class EthereumAnchorService extends AnchorService { * @param anchorProof - Anchor proof instance */ async validateChainInclusion(anchorProof: AnchorProof): Promise { - const decoded = decode(anchorProof.txHash.multihash); + const decoded = decode(Buffer.from(anchorProof.txHash.bytes)); const txHash = decoded.digest.toString("hex"); // determine network based on a chain ID From 3568007ad49b49565ffd77c7427a879566370021 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Wed, 2 Sep 2020 18:19:13 +0200 Subject: [PATCH 2/7] fix: fix snapshots and ethereum anchor service --- .../ethereum/ethereum-anchor-service.ts | 2 +- .../account-link-doctype.test.ts.snap | 450 +++++++++--------- .../three-id-doctype.test.ts.snap | 450 +++++++++--------- .../__snapshots__/tile-doctype.test.ts.snap | 450 +++++++++--------- 4 files changed, 649 insertions(+), 703 deletions(-) diff --git a/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts b/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts index 29a2b24830..b7b5edfc54 100644 --- a/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts +++ b/packages/ceramic-core/src/anchor/ethereum/ethereum-anchor-service.ts @@ -160,7 +160,7 @@ export default class EthereumAnchorService extends AnchorService { * @param anchorProof - Anchor proof instance */ async validateChainInclusion(anchorProof: AnchorProof): Promise { - const decoded = decode(Buffer.from(anchorProof.txHash.bytes)); + const decoded = decode(Buffer.from(anchorProof.txHash.multihash)); const txHash = decoded.digest.toString("hex"); // determine network based on a chain ID diff --git a/packages/ceramic-doctype-account-link/src/__tests__/__snapshots__/account-link-doctype.test.ts.snap b/packages/ceramic-doctype-account-link/src/__tests__/__snapshots__/account-link-doctype.test.ts.snap index 631c8d6302..2c5a016d6c 100644 --- a/packages/ceramic-doctype-account-link/src/__tests__/__snapshots__/account-link-doctype.test.ts.snap +++ b/packages/ceramic-doctype-account-link/src/__tests__/__snapshots__/account-link-doctype.test.ts.snap @@ -11,131 +11,122 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 119, - 169, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 119, + 169, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -159,45 +150,42 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -221,88 +209,82 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], diff --git a/packages/ceramic-doctype-three-id/src/__tests__/__snapshots__/three-id-doctype.test.ts.snap b/packages/ceramic-doctype-three-id/src/__tests__/__snapshots__/three-id-doctype.test.ts.snap index 7f4c24139b..7aa82cc084 100644 --- a/packages/ceramic-doctype-three-id/src/__tests__/__snapshots__/three-id-doctype.test.ts.snap +++ b/packages/ceramic-doctype-three-id/src/__tests__/__snapshots__/three-id-doctype.test.ts.snap @@ -16,131 +16,122 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 119, - 169, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 119, + 169, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -166,45 +157,42 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -233,88 +221,82 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], diff --git a/packages/ceramic-doctype-tile/src/__tests__/__snapshots__/tile-doctype.test.ts.snap b/packages/ceramic-doctype-tile/src/__tests__/__snapshots__/tile-doctype.test.ts.snap index 86d239e205..a9b53e63c5 100644 --- a/packages/ceramic-doctype-tile/src/__tests__/__snapshots__/tile-doctype.test.ts.snap +++ b/packages/ceramic-doctype-tile/src/__tests__/__snapshots__/tile-doctype.test.ts.snap @@ -14,131 +14,122 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 119, - 169, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 119, + 169, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -162,45 +153,42 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], @@ -227,88 +215,82 @@ Object { "log": Array [ Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 111, - 105, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 111, + 105, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, Object { "codec": "dag-pb", - "hash": Object { - "data": Array [ - 18, - 32, - 222, - 189, - 122, - 219, - 60, - 229, - 101, - 68, - 210, - 42, - 111, - 107, - 147, - 57, - 115, - 137, - 128, - 168, - 6, - 124, - 44, - 193, - 52, - 240, - 247, - 128, - 27, - 99, - 49, - 9, - 43, - 149, - ], - "type": "Buffer", - }, + "hash": Uint8Array [ + 18, + 32, + 222, + 189, + 122, + 219, + 60, + 229, + 101, + 68, + 210, + 42, + 111, + 107, + 147, + 57, + 115, + 137, + 128, + 168, + 6, + 124, + 44, + 193, + 52, + 240, + 247, + 128, + 27, + 99, + 49, + 9, + 43, + 149, + ], "version": 1, }, ], From 4eea3c741d969222310e318761bd2a9b01edc8ad Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Thu, 3 Sep 2020 01:39:20 +0200 Subject: [PATCH 3/7] fix: add custom built ipfs dependencies --- packages/ceramic-cli/package.json | 4 ++-- .../ceramic-cli/src/__tests__/ceramic-daemon.test.ts | 9 +++++---- packages/ceramic-common/package.json | 3 ++- packages/ceramic-core/package.json | 4 ++-- packages/ceramic-doctype-account-link/package.json | 2 +- packages/ceramic-doctype-three-id/package.json | 2 +- packages/ceramic-doctype-tile/package.json | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/ceramic-cli/package.json b/packages/ceramic-cli/package.json index b1a53167fe..da4e6ff6cc 100644 --- a/packages/ceramic-cli/package.json +++ b/packages/ceramic-cli/package.json @@ -45,8 +45,8 @@ "commander": "^6.0.0", "express": "^4.17.1", "identity-wallet": "2.0.0-alpha.1", - "ipfs": "^0.49.0", - "ipfs-http-client": "^46.0.0" + "ipfs": "github:simonovic86/ipfs", + "ipfs-http-client": "github:simonovic86/ipfs-http-client" }, "devDependencies": { "@babel/core": "^7.9.0", diff --git a/packages/ceramic-cli/src/__tests__/ceramic-daemon.test.ts b/packages/ceramic-cli/src/__tests__/ceramic-daemon.test.ts index eadd04c9a8..06a2404743 100644 --- a/packages/ceramic-cli/src/__tests__/ceramic-daemon.test.ts +++ b/packages/ceramic-cli/src/__tests__/ceramic-daemon.test.ts @@ -7,6 +7,7 @@ import CeramicDaemon from '../ceramic-daemon' import { AnchorStatus, IpfsUtils } from "@ceramicnetwork/ceramic-common" import { TileDoctypeHandler } from "@ceramicnetwork/ceramic-doctype-tile" import { EventEmitter } from "events" +import { DoctypeUtils } from "@ceramicnetwork/ceramic-common/lib" const seed = '0x5872d6e0ae7347b72c9216db218ebbb9d9d0ae7ab818ead3557e8e78bf944184' const anchorUpdate = (doc: EventEmitter): Promise => new Promise(resolve => doc.on('change', resolve)) @@ -97,13 +98,13 @@ describe('Ceramic interop: core <> http-client', () => { await anchorUpdate(doc1) const doc2 = await client.loadDocument(doc1.id) expect(doc1.content).toEqual(doc2.content) - expect(doc1.state).toEqual(doc2.state) + expect(DoctypeUtils.serializeState(doc1.state)).toEqual(DoctypeUtils.serializeState(doc2.state)) const doc3 = await client.createDocument(DOCTYPE_TILE, { content: { test: 456 } }) await anchorUpdate(doc3) const doc4 = await core.loadDocument(doc3.id) expect(doc3.content).toEqual(doc4.content) - expect(doc3.state).toEqual(doc4.state) + expect(DoctypeUtils.serializeState(doc3.state)).toEqual(DoctypeUtils.serializeState(doc4.state)) }) it('makes and gets updates correctly', async () => { @@ -115,13 +116,13 @@ describe('Ceramic interop: core <> http-client', () => { await anchorUpdate(doc1) await anchorUpdate(doc2) expect(doc1.content).toEqual(doc2.content) - expect(doc1.state).toEqual(doc2.state) + expect(DoctypeUtils.serializeState(doc1.state)).toEqual(DoctypeUtils.serializeState(doc2.state)) // change from client viewable in core await doc2.change({ content: {test: 456, abc: 654} }) await anchorUpdate(doc2) expect(doc1.content).toEqual(doc2.content) - expect(doc1.state).toEqual(doc2.state) + expect(DoctypeUtils.serializeState(doc1.state)).toEqual(DoctypeUtils.serializeState(doc2.state)) }) }) diff --git a/packages/ceramic-common/package.json b/packages/ceramic-common/package.json index 26e459339a..96265b5d33 100644 --- a/packages/ceramic-common/package.json +++ b/packages/ceramic-common/package.json @@ -31,7 +31,8 @@ "cids": "^1.0.0", "dag-jose": "^0.1.1", "did-resolver": "^2.1.1", - "ipfs": "^0.49.0", + "ipfs": "github:simonovic86/ipfs", + "ipfs-core-utils": "github:simonovic86/ipfs-core-utils", "lodash.clonedeep": "^4.5.0", "multiformats": "^3.0.3" }, diff --git a/packages/ceramic-core/package.json b/packages/ceramic-core/package.json index b80ab45062..89f3e53f3b 100644 --- a/packages/ceramic-core/package.json +++ b/packages/ceramic-core/package.json @@ -43,7 +43,7 @@ "did-resolver": "^2.1.1", "dids": "^0.5.0", "fast-json-patch": "^2.2.1", - "ipfs-http-client": "^46.0.0", + "ipfs-http-client": "github:simonovic86/ipfs-http-client", "level-ts": "^2.0.5", "lodash.clonedeep": "^4.5.0", "typestub-multihashes": "^0.0.4" @@ -64,7 +64,7 @@ "eslint": "^6.8.0", "eslint-plugin-jest": "^23.8.2", "identity-wallet": "2.0.0-alpha.1", - "ipfs": "^0.49.0", + "ipfs": "github:simonovic86/ipfs", "jest": "^25.1.0", "js-sha256": "^0.9.0", "tmp-promise": "^2.0.2" diff --git a/packages/ceramic-doctype-account-link/package.json b/packages/ceramic-doctype-account-link/package.json index 03a58bd974..2bd221317c 100644 --- a/packages/ceramic-doctype-account-link/package.json +++ b/packages/ceramic-doctype-account-link/package.json @@ -45,7 +45,7 @@ "eslint": "^6.8.0", "eslint-plugin-jest": "^23.8.2", "identity-wallet": "2.0.0-alpha.1", - "ipfs": "^0.49.0", + "ipfs": "github:simonovic86/ipfs", "jest": "^25.1.0", "js-sha256": "^0.9.0", "tmp-promise": "^2.0.2" diff --git a/packages/ceramic-doctype-three-id/package.json b/packages/ceramic-doctype-three-id/package.json index eaca4e91e6..49fa491280 100644 --- a/packages/ceramic-doctype-three-id/package.json +++ b/packages/ceramic-doctype-three-id/package.json @@ -50,7 +50,7 @@ "eslint": "^6.8.0", "eslint-plugin-jest": "^23.8.2", "identity-wallet": "2.0.0-alpha.1", - "ipfs": "^0.49.0", + "ipfs": "github:simonovic86/ipfs", "jest": "^25.1.0", "js-sha256": "^0.9.0", "tmp-promise": "^2.0.2" diff --git a/packages/ceramic-doctype-tile/package.json b/packages/ceramic-doctype-tile/package.json index bf10a86564..c0e85086dc 100644 --- a/packages/ceramic-doctype-tile/package.json +++ b/packages/ceramic-doctype-tile/package.json @@ -52,7 +52,7 @@ "eslint": "^6.8.0", "eslint-plugin-jest": "^23.8.2", "identity-wallet": "2.0.0-alpha.1", - "ipfs": "^0.49.0", + "ipfs": "github:simonovic86/ipfs", "jest": "^25.1.0", "js-sha256": "^0.9.0", "tmp-promise": "^2.0.2" From d3f4dbdc2a768620e7298090ddad6658c0cf9fd7 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Thu, 3 Sep 2020 01:51:01 +0200 Subject: [PATCH 4/7] fix(core): fix test --- packages/ceramic-core/src/__tests__/ceramic.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/ceramic-core/src/__tests__/ceramic.test.ts b/packages/ceramic-core/src/__tests__/ceramic.test.ts index 4cf97400d1..8e08325669 100644 --- a/packages/ceramic-core/src/__tests__/ceramic.test.ts +++ b/packages/ceramic-core/src/__tests__/ceramic.test.ts @@ -170,6 +170,10 @@ describe('Ceramic integration', () => { } const doctype3 = await ceramic3.createDocument(DOCTYPE_3ID, { content: { test: 321 }, metadata: { owners: [owner] } }, { applyOnly: true }) + while (doctype3.state.anchorStatus !== AnchorStatus.ANCHORED) { + // wait to propagate + await new Promise(resolve => setTimeout(resolve, 100)) + } expect(doctype3.content).toEqual(doctype1.content) expect(doctype3.state).toEqual(doctype1.state) From 8709162db136f81967728fb06534922319c8275c Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Thu, 3 Sep 2020 01:58:45 +0200 Subject: [PATCH 5/7] fix(core): fix failing test --- packages/ceramic-core/src/__tests__/ceramic.test.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/ceramic-core/src/__tests__/ceramic.test.ts b/packages/ceramic-core/src/__tests__/ceramic.test.ts index 8e08325669..b4e21314c3 100644 --- a/packages/ceramic-core/src/__tests__/ceramic.test.ts +++ b/packages/ceramic-core/src/__tests__/ceramic.test.ts @@ -25,7 +25,7 @@ const createCeramic = async (ipfs: Ipfs): Promise => { } describe('Ceramic integration', () => { - jest.setTimeout(20000) + jest.setTimeout(200000) let ipfs1: Ipfs; let ipfs2: Ipfs; let ipfs3: Ipfs; @@ -164,16 +164,7 @@ describe('Ceramic integration', () => { // ceramic node 2 shouldn't need to have the document open in order to forward the message const doctype1 = await ceramic1.createDocument(DOCTYPE_3ID, { content: { test: 321 }, metadata: { owners: [owner] } }) - while (doctype1.state.anchorStatus !== AnchorStatus.ANCHORED) { - // wait to propagate - await new Promise(resolve => setTimeout(resolve, 100)) - } - const doctype3 = await ceramic3.createDocument(DOCTYPE_3ID, { content: { test: 321 }, metadata: { owners: [owner] } }, { applyOnly: true }) - while (doctype3.state.anchorStatus !== AnchorStatus.ANCHORED) { - // wait to propagate - await new Promise(resolve => setTimeout(resolve, 100)) - } expect(doctype3.content).toEqual(doctype1.content) expect(doctype3.state).toEqual(doctype1.state) From d50dfa358dac7368ad2ab6255532e6043eaa97b4 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Thu, 3 Sep 2020 01:59:21 +0200 Subject: [PATCH 6/7] chore(core): remove import --- packages/ceramic-core/src/__tests__/ceramic.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ceramic-core/src/__tests__/ceramic.test.ts b/packages/ceramic-core/src/__tests__/ceramic.test.ts index b4e21314c3..5c97ea451f 100644 --- a/packages/ceramic-core/src/__tests__/ceramic.test.ts +++ b/packages/ceramic-core/src/__tests__/ceramic.test.ts @@ -2,7 +2,7 @@ import Ceramic from '../ceramic' import IdentityWallet from 'identity-wallet' import tmp from 'tmp-promise' import Ipfs from 'ipfs' -import { AnchorStatus, IpfsUtils } from "@ceramicnetwork/ceramic-common" +import { IpfsUtils } from "@ceramicnetwork/ceramic-common" import { ThreeIdDoctype } from "@ceramicnetwork/ceramic-doctype-three-id" jest.mock('../store/level-state-store') From 956b54dd9c5fb4019f1d4d8f0795e2677a784bc9 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Thu, 3 Sep 2020 02:17:28 +0200 Subject: [PATCH 7/7] fix(core): refactor test --- packages/ceramic-core/src/__tests__/ceramic.test.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/ceramic-core/src/__tests__/ceramic.test.ts b/packages/ceramic-core/src/__tests__/ceramic.test.ts index 5c97ea451f..7ce48f4a34 100644 --- a/packages/ceramic-core/src/__tests__/ceramic.test.ts +++ b/packages/ceramic-core/src/__tests__/ceramic.test.ts @@ -2,7 +2,7 @@ import Ceramic from '../ceramic' import IdentityWallet from 'identity-wallet' import tmp from 'tmp-promise' import Ipfs from 'ipfs' -import { IpfsUtils } from "@ceramicnetwork/ceramic-common" +import { AnchorStatus, IpfsUtils } from "@ceramicnetwork/ceramic-common" import { ThreeIdDoctype } from "@ceramicnetwork/ceramic-doctype-three-id" jest.mock('../store/level-state-store') @@ -25,7 +25,7 @@ const createCeramic = async (ipfs: Ipfs): Promise => { } describe('Ceramic integration', () => { - jest.setTimeout(200000) + jest.setTimeout(20000) let ipfs1: Ipfs; let ipfs2: Ipfs; let ipfs3: Ipfs; @@ -164,7 +164,14 @@ describe('Ceramic integration', () => { // ceramic node 2 shouldn't need to have the document open in order to forward the message const doctype1 = await ceramic1.createDocument(DOCTYPE_3ID, { content: { test: 321 }, metadata: { owners: [owner] } }) + while (doctype1.state.anchorStatus !== AnchorStatus.ANCHORED) { + await new Promise(resolve => setTimeout(resolve, 1000)) + } + const doctype3 = await ceramic3.createDocument(DOCTYPE_3ID, { content: { test: 321 }, metadata: { owners: [owner] } }, { applyOnly: true }) + while (doctype3.state.anchorStatus !== AnchorStatus.ANCHORED) { + await new Promise(resolve => setTimeout(resolve, 1000)) + } expect(doctype3.content).toEqual(doctype1.content) expect(doctype3.state).toEqual(doctype1.state)