From bd197ff07f658214dc3a0f571a4f750685532c32 Mon Sep 17 00:00:00 2001 From: Janko Simonovic Date: Sat, 22 Jun 2019 15:41:42 +0200 Subject: [PATCH] Expand parameters (#942) (#943) * expand parameters --- config/config.json | 15 ++++++++++----- .../command/dh/dh-replication-import-command.js | 4 ++++ package-lock.json | 2 +- package.json | 2 +- setup_arangodb.sh | 2 +- test/modules/utilities.test.js | 2 +- testnet/install-arango.sh | 2 +- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/config/config.json b/config/config.json index 4feb430f19..be35d05c56 100644 --- a/config/config.json +++ b/config/config.json @@ -96,7 +96,8 @@ "dh_min_litigation_interval_in_minutes": 5, "deposit_on_demand": true, "dc_choose_time": 600000, - "requireApproval": false + "requireApproval": false, + "dh_max_data_set_size": 1000000 }, "staging": { "identity": null, @@ -195,7 +196,8 @@ "dh_min_litigation_interval_in_minutes": 5, "deposit_on_demand": false, "dc_choose_time": 600000, - "requireApproval": false + "requireApproval": false, + "dh_max_data_set_size": 1000000 }, "stable": { "identity": null, @@ -294,7 +296,8 @@ "dh_min_litigation_interval_in_minutes": 5, "deposit_on_demand": false, "dc_choose_time": 600000, - "requireApproval": false + "requireApproval": false, + "dh_max_data_set_size": 1000000 }, "production": { "identity": null, @@ -396,7 +399,8 @@ "dh_min_litigation_interval_in_minutes": 5, "deposit_on_demand": false, "dc_choose_time": 600000, - "requireApproval": false + "requireApproval": false, + "dh_max_data_set_size": 1000000 }, "mariner": { "identity": null, @@ -498,6 +502,7 @@ "dh_min_litigation_interval_in_minutes": 5, "deposit_on_demand": false, "dc_choose_time": 600000, - "requireApproval": true + "requireApproval": true, + "dh_max_data_set_size": 1000000 } } diff --git a/modules/command/dh/dh-replication-import-command.js b/modules/command/dh/dh-replication-import-command.js index 383eb932af..a878d8f0e4 100644 --- a/modules/command/dh/dh-replication-import-command.js +++ b/modules/command/dh/dh-replication-import-command.js @@ -53,6 +53,10 @@ class DhReplicationImportCommand extends Command { const calculatedDataSetId = await ImportUtilities.importHash(dataSetId, decryptedVertices, edges); + if (bytes(JSON.stringify(litigationVertices)) > this.config.dh_max_data_set_size) { + throw new Error(`Data set size is bigger than given limit of ${this.config.dh_max_data_set_size} bytes`); + } + if (dataSetId !== calculatedDataSetId) { throw new Error(`Calculated data set ID ${calculatedDataSetId} differs from DC data set ID ${dataSetId}`); } diff --git a/package-lock.json b/package-lock.json index cf6f48aae5..088216afed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "2.0.55", + "version": "2.0.56", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2bcc72b643..6608f23135 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "2.0.55", + "version": "2.0.56", "description": "OriginTrail node", "main": ".eslintrc.js", "config": { diff --git a/setup_arangodb.sh b/setup_arangodb.sh index e4741973e2..b8a085abbd 100755 --- a/setup_arangodb.sh +++ b/setup_arangodb.sh @@ -10,7 +10,7 @@ echo arangodb3 arangodb3/upgrade boolean true | debconf-set-selections echo arangodb3 arangodb3/storage_engine select mmfiles | debconf-set-selections echo arangodb3 arangodb3/password password root | debconf-set-selections echo arangodb3 arangodb3/password_again password root | debconf-set-selections -apt-get install arangodb3=3.3.12 -y +apt-get install arangodb3=3.3.12 -y --allow-unauthenticated sed -i 's/authentication = true/authentication = false/g' /etc/arangodb3/arangod.conf systemctl start arangodb3 diff --git a/test/modules/utilities.test.js b/test/modules/utilities.test.js index 8c06fe7160..31cda13839 100644 --- a/test/modules/utilities.test.js +++ b/test/modules/utilities.test.js @@ -27,7 +27,7 @@ describe('Utilities module', () => { 'is_bootstrap_node', 'houston_password', 'enable_debug_logs_level', 'reverse_tunnel_address', 'reverse_tunnel_port', 'autoUpdater', 'bugSnag', 'network', 'dataSetStorage', 'dc_holding_time_in_minutes', 'dc_choose_time', 'dc_litigation_interval_in_minutes', 'dc_token_amount_per_holder', 'dh_max_holding_time_in_minutes', 'dh_min_litigation_interval_in_minutes', 'dh_min_token_price', - 'erc725_identity_filepath', 'deposit_on_demand', 'requireApproval'], + 'erc725_identity_filepath', 'deposit_on_demand', 'requireApproval', 'dh_max_data_set_size'], `Some config items are missing in config for environment '${environment}'`, ); assert.hasAllKeys( diff --git a/testnet/install-arango.sh b/testnet/install-arango.sh index 12eec433ac..ab72ced0db 100644 --- a/testnet/install-arango.sh +++ b/testnet/install-arango.sh @@ -9,4 +9,4 @@ echo arangodb3 arangodb3/upgrade boolean true | debconf-set-selections echo arangodb3 arangodb3/storage_engine select mmfiles | debconf-set-selections echo arangodb3 arangodb3/password password root | debconf-set-selections echo arangodb3 arangodb3/password_again password root | debconf-set-selections -apt-get install arangodb3=3.3.12 -y \ No newline at end of file +apt-get install arangodb3=3.3.12 -y --allow-unauthenticated \ No newline at end of file