diff --git a/config/config.json b/config/config.json index 02a1d1a26d..95a6e76ebe 100644 --- a/config/config.json +++ b/config/config.json @@ -175,7 +175,7 @@ }, "network": { "hostname": "127.0.0.1", - "id": "StagenetV1.0.0", + "id": "StagenetV1.0.1", "bootstraps": ["https://stagingbs.origintrial.me:5278/#1754b56ce26212eab45bc523c36e1d4bf57ea30e"], "remoteWhitelist": ["54.93.223.161", "127.0.0.1"], "solutionDifficulty": 14, @@ -275,7 +275,7 @@ }, "network": { "hostname": "127.0.0.1", - "id": "StablenetV1.0.0", + "id": "StablenetV1.0.1", "bootstraps": ["https://82.196.10.12:5278/#e2f7ab11d0dd34595dfb2e71b4937ec8d790df84"], "remoteWhitelist": ["54.93.223.161", "127.0.0.1"], "solutionDifficulty": 14, @@ -375,7 +375,7 @@ }, "network": { "hostname": "127.0.0.1", - "id": "TestnetV2.0.0b", + "id": "TestnetV2.0.1b", "bootstraps": [ "https://46.101.233.127:5278/#41d7357b322ca75d1187b3163b510ff704e9a040", "https://82.196.6.215:5278/#9e7f1ec47d0da65b9f2e004510ae366519290dff" @@ -478,7 +478,7 @@ }, "network": { "hostname": "127.0.0.1", - "id": "MarinerV1.0.0", + "id": "MarinerV1.0.1", "bootstraps": [ "https://35.159.51.107:5278/#3e3f9f62aa3e55c4bc2e307e2164357e538466a5", "https://142.93.13.94:5278/#6d3e620c2c4062e67ed16f86c2fd9c6fec739644" diff --git a/modules/Database/Arangojs.js b/modules/Database/Arangojs.js index 99ffc5a87c..1cb770cb19 100644 --- a/modules/Database/Arangojs.js +++ b/modules/Database/Arangojs.js @@ -685,8 +685,18 @@ class ArangoJS { return normalizedVertices.concat(objectClasses); } + /** + * Finds object vertices. + * TODO We need to change the query. This is not the appropriate way. + * @return {Promise} + */ async findObjectClassVertices() { - const queryString = 'FOR v IN ot_vertices FILTER v.vertex_type == "CLASS" AND v.datasets == null SORT v._key RETURN v'; + const queryString = 'FOR v IN ot_vertices ' + + 'FILTER v.vertex_type == "CLASS" ' + + 'AND v.datasets == null ' + + 'AND v._dc_key == null ' + + 'SORT v._key ' + + 'RETURN v'; return this.runQuery(queryString, {}); } diff --git a/modules/Database/graph-converter.js b/modules/Database/graph-converter.js index f8cbf63e88..6adb72297c 100644 --- a/modules/Database/graph-converter.js +++ b/modules/Database/graph-converter.js @@ -4,7 +4,7 @@ function denormalizeGraph(importId, vertices, edges) { const denormalizedEdges = edges; vertices.forEach((vertex) => { - if (vertex.vertex_type !== 'IDENTIFIER') { + if (vertex.vertex_type !== 'IDENTIFIER' && vertex.vertex_type !== 'CLASS') { const denormalizedVertex = { [importId]: {}, }; @@ -43,7 +43,7 @@ function normalizeGraph(importId, vertices, edges) { vertices.forEach((vertex) => { const normalizedVertex = {}; - if (vertex.vertex_type !== 'IDENTIFIER' && vertex[importId]) { + if (vertex.vertex_type !== 'IDENTIFIER' && vertex[importId] && vertex.vertex_type !== 'CLASS') { normalizedVertex.data = vertex[importId].data; if (vertex._dc_key) { diff --git a/modules/EventEmitter.js b/modules/EventEmitter.js index 148a400498..69aa39055e 100644 --- a/modules/EventEmitter.js +++ b/modules/EventEmitter.js @@ -326,7 +326,6 @@ class EventEmitter { message: 'Query sent successfully.', query_id: queryId, }); - dvController.handleQuery(queryId, 60000); }).catch((error) => { logger.error(`Failed query network. ${error}.`); notifyError(error); diff --git a/modules/command/dv/dv-query-network-command.js b/modules/command/dv/dv-query-network-command.js index 9911b9f304..e048e4ad8e 100644 --- a/modules/command/dv/dv-query-network-command.js +++ b/modules/command/dv/dv-query-network-command.js @@ -71,7 +71,18 @@ class DVQueryNetworkCommand extends Command { await this.transport.publish('kad-data-location-request', dataLocationRequestObject); this.logger.info(`Published query to the network. Query ID ${queryId}.`); - return Command.empty(); + return { + commands: [ + { + name: 'dvHandleNetworkQueryResponsesCommand', + delay: 60000, + data: { + queryId, + }, + transactional: false, + }, + ], + }; } /** diff --git a/modules/importer.js b/modules/importer.js index f71a0f6fd1..e12ce0d0fd 100644 --- a/modules/importer.js +++ b/modules/importer.js @@ -127,9 +127,19 @@ class Importer { // TODO: Use transaction here. await Promise.all(denormalizedVertices.map(vertex => this.graphStorage.addVertex(vertex)) .concat(edges.map(edge => this.graphStorage.addEdge(edge)))); - await Promise.all(vertices.map(vertex => this.graphStorage.updateImports('ot_vertices', vertex, dataSetId)) - .concat(edges.map(edge => this.graphStorage.updateImports('ot_edges', edge, dataSetId)))); + if (encColor == null) { + // it's encrypted + await Promise.all(vertices + .filter(vertex => vertex.vertex_type !== 'CLASS') + .map(vertex => this.graphStorage.updateImports('ot_vertices', vertex, dataSetId)) + .concat(edges.map(edge => this.graphStorage.updateImports('ot_edges', edge, dataSetId)))); + } else { + // not encrypted + await Promise.all(vertices + .map(vertex => this.graphStorage.updateImports('ot_vertices', vertex, dataSetId)) + .concat(edges.map(edge => this.graphStorage.updateImports('ot_edges', edge, dataSetId)))); + } this.log.info('JSON import complete'); if (!packKeys) { diff --git a/modules/network/kademlia/kademlia.js b/modules/network/kademlia/kademlia.js index 10fd6f24dd..0d51124d6f 100644 --- a/modules/network/kademlia/kademlia.js +++ b/modules/network/kademlia/kademlia.js @@ -234,7 +234,7 @@ class Kademlia { this.node.hashcash = this.node.plugin(kadence.hashcash({ methods: [ - 'PUBLISH', 'SUBSCRIBE', 'kad-data-location-request', + 'kad-data-location-request', 'kad-replication-finished', 'kad-data-location-response', 'kad-data-read-request', 'kad-data-read-response', 'kad-send-encrypted-key', 'kad-encrypted-key-process-result', diff --git a/package-lock.json b/package-lock.json index 00248af890..f7f34fbc2c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "2.0.28", + "version": "2.0.29", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2101,7 +2101,7 @@ "dependencies": { "async": { "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" } } @@ -2746,7 +2746,7 @@ }, "css-select": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "requires": { "boolbase": "1.0.0", @@ -3261,7 +3261,7 @@ "dependencies": { "domelementtype": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "resolved": "http://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=" } } @@ -12695,7 +12695,7 @@ }, "needle": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/needle/-/needle-1.1.2.tgz", + "resolved": "http://registry.npmjs.org/needle/-/needle-1.1.2.tgz", "integrity": "sha1-0oQaElv9dP77MMA0QQQ2kGHD4To=", "requires": { "debug": "2.6.9", @@ -12729,7 +12729,7 @@ "dependencies": { "async": { "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" } } diff --git a/package.json b/package.json index 37ce34dd41..60366c138b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "2.0.28", + "version": "2.0.29", "description": "OriginTrail node", "main": ".eslintrc.js", "config": {