diff --git a/README.md b/README.md index 1340c4086..d9eeb6900 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ __OriginTrail is an ecosystem dedicated to making global supply chains work toge This repository contains a work-in-progress code for a network node. -__OriginTrail Decentralized Network (ODN)__ is currently running in the __OriginTrail Vostok Mainnet__ stage. For further information about the roadmap please see our [website](https://tech.origintrail.io/roadmap). +__OriginTrail Decentralized Network (ODN)__ is currently running in the __Freedom-Gemini__ stage. For further information about the roadmap please see our [website](https://tech.origintrail.io/roadmap). [Please see our main documentation page for more information](http://docs.origintrail.io) diff --git a/config/config.json b/config/config.json index b492b3faf..15854331c 100644 --- a/config/config.json +++ b/config/config.json @@ -17,6 +17,7 @@ "ssl_certificate_path": "kademlia.crt", "identity_filepath": "identity.json", "erc725_identity_filepath": "erc725_identity.json", + "houston_password_file_name": "houston.txt", "cpus": 0, "embedded_peercache_path": "peercache", "onion_virtual_port": "4043", @@ -121,6 +122,7 @@ "ssl_certificate_path": "kademlia.crt", "identity_filepath": "identity.json", "erc725_identity_filepath": "erc725_identity.json", + "houston_password_file_name": "houston.txt", "cpus": 0, "embedded_peercache_path": "peercache", "onion_virtual_port": "4043", @@ -229,6 +231,7 @@ "ssl_certificate_path": "kademlia.crt", "identity_filepath": "identity.json", "erc725_identity_filepath": "erc725_identity.json", + "houston_password_file_name": "houston.txt", "cpus": 0, "embedded_peercache_path": "peercache", "onion_virtual_port": "4043", diff --git a/modules/logger.js b/modules/logger.js index b66e5aeb5..71dfec40a 100644 --- a/modules/logger.js +++ b/modules/logger.js @@ -189,12 +189,6 @@ class Logger { * @return {*} */ static transformLog(level, msg) { - if (process.env.LOGS_LEVEL_DEBUG) { - return { - level, - msg, - }; - } if (msg.startsWith('connection timed out')) { return null; } @@ -213,6 +207,9 @@ class Logger { if (msg.startsWith('updating peer profile')) { return null; } + if (msg.startsWith('updating cached peer profile')) { + return null; + } if (msg.includes('client cannot service request at this time')) { return null; } diff --git a/modules/network/kademlia/kademlia.js b/modules/network/kademlia/kademlia.js index ab93ab7a4..4c7c132d8 100644 --- a/modules/network/kademlia/kademlia.js +++ b/modules/network/kademlia/kademlia.js @@ -203,12 +203,12 @@ class Kademlia { next(); }); - this.node.blacklist = this.node.plugin(kadence.churnfilter({ - cooldownBaseTimeout: this.config.network.churnPlugin.cooldownBaseTimeout, - cooldownMultiplier: - parseInt(this.config.network.churnPlugin.cooldownMultiplier, 10), - cooldownResetTime: this.config.network.churnPlugin.cooldownResetTime, - })); + // this.node.blacklist = this.node.plugin(kadence.churnfilter({ + // cooldownBaseTimeout: this.config.network.churnPlugin.cooldownBaseTimeout, + // cooldownMultiplier: + // parseInt(this.config.network.churnPlugin.cooldownMultiplier, 10), + // cooldownResetTime: this.config.network.churnPlugin.cooldownResetTime, + // })); if (this.config.traverse_nat_enabled) { this.enableNatTraversal(); } diff --git a/modules/service/pricing-service.js b/modules/service/pricing-service.js index bcd42fc84..4538312b7 100644 --- a/modules/service/pricing-service.js +++ b/modules/service/pricing-service.js @@ -44,12 +44,14 @@ class PricingService { async getGasPrice() { if (process.env.NODE_ENV === 'development') { + this.logger.trace(`Using default gas price from configuration: ${this.config.blockchain.gas_price}`); return this.config.blockchain.gas_price; } const now = new Date().getTime(); if (this.config.blockchain.gas_price_last_update_timestamp + constants.GAS_PRICE_VALIDITY_TIME_IN_MILLS > now) { + this.logger.trace(`Using gas price from configuration: ${this.config.blockchain.gas_price}`); return this.config.blockchain.gas_price; } let gasStationGasPrice = await this.gasStationService.getGasPrice() @@ -59,19 +61,23 @@ class PricingService { let web3GasPrice = await this.web3.eth.getGasPrice() .catch((err) => { this.logger.warn(err); }) * constants.AVERAGE_GAS_PRICE_MULTIPLIER; web3GasPrice = Math.round(web3GasPrice); - if (gasStationGasPrice && web3GasPrice) { const gasPrice = ( gasStationGasPrice > web3GasPrice ? gasStationGasPrice : web3GasPrice); this.saveNewGasPriceAndTime(gasPrice); + const service = gasStationGasPrice > web3GasPrice ? 'gas station' : 'web3'; + this.logger.trace(`Using gas price from ${service} service: ${gasStationGasPrice}`); return gasPrice; } else if (gasStationGasPrice) { this.saveNewGasPriceAndTime(gasStationGasPrice); + this.logger.trace(`Using gas price from gas station service: ${gasStationGasPrice}`); return gasStationGasPrice; } else if (web3GasPrice) { this.saveNewGasPriceAndTime(web3GasPrice); + this.logger.trace(`Using gas price from web3 service: ${web3GasPrice}`); return web3GasPrice; } + this.logger.trace(`Using gas price from configuration: ${this.config.blockchain.gas_price}`); return this.config.blockchain.gas_price; } diff --git a/modules/service/trac-price-service.js b/modules/service/trac-price-service.js index 2073cffdf..39e81fb79 100644 --- a/modules/service/trac-price-service.js +++ b/modules/service/trac-price-service.js @@ -11,15 +11,17 @@ class TracPriceService { async getTracPriceInEth() { if (process.env.NODE_ENV === 'development') { + this.logger.trace(`Using default trac price in eth from configuration: ${this.config.blockchain.trac_price_in_eth}`); return this.config.blockchain.trac_price_in_eth; } const now = new Date().getTime(); if (this.config.blockchain.trac_price_in_eth_last_update_timestamp + constants.TRAC_PRICE_IN_ETH_VALIDITY_TIME_IN_MILLS > now) { + this.logger.trace(`Using trac price in eth from configuration: ${this.config.blockchain.trac_price_in_eth}`); return this.config.blockchain.trac_price_in_eth; } - let tracPriceInEth; + let tracPriceInEth = this.config.blockchain.trac_price_in_eth; const response = await axios.get(coinGeckoLink) .catch((err) => { this.logger.warn(err); @@ -29,9 +31,12 @@ class TracPriceService { } if (tracPriceInEth) { this._saveNewTracPriceInEth(tracPriceInEth); - return tracPriceInEth; + this.logger.trace(`Using trac price in eth from coingecko service: ${tracPriceInEth}`); + } else { + tracPriceInEth = this.config.blockchain.trac_price_in_eth; + this.logger.trace(`Using trac price in eth from configuration: ${tracPriceInEth}`); } - return this.config.blockchain.trac_price_in_eth; + return tracPriceInEth; } _saveNewTracPriceInEth(tracePrice) { diff --git a/ot-node.js b/ot-node.js index a2404d9cc..74efdf716 100644 --- a/ot-node.js +++ b/ot-node.js @@ -426,16 +426,19 @@ class OTNode { process.exit(1); } - // Fetch Houston access password - if (!config.houston_password) { + const houstonPasswordFilePath = path + .join(config.appDataPath, config.houston_password_file_name); + if (fs.existsSync(houstonPasswordFilePath)) { + log.info('Using existing houston password.'); + config.houston_password = fs.readFileSync(houstonPasswordFilePath).toString(); + } else { config.houston_password = uuidv4(); + fs.writeFileSync(houstonPasswordFilePath, config.houston_password); + log.notify('================================================================'); + log.notify(' Houston password generated and stored in file '); + log.notify('================================================================'); } - fs.writeFileSync(path.join(config.appDataPath, 'houston.txt'), config.houston_password); - log.notify('================================================================'); - log.notify('Houston password stored in file '); - log.notify('================================================================'); - // Starting the kademlia const transport = container.resolve('transport'); await transport.init(container.cradle); diff --git a/package.json b/package.json index d10952fa0..c66d9e2a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "4.0.0", + "version": "4.0.1", "description": "OriginTrail node", "main": ".eslintrc.js", "config": { diff --git a/test/modules/utilities.test.js b/test/modules/utilities.test.js index 9ec0b321f..1206af47d 100644 --- a/test/modules/utilities.test.js +++ b/test/modules/utilities.test.js @@ -23,7 +23,7 @@ describe('Utilities module', () => { 'ssl_authority_paths', 'node_rpc_port', 'remote_control_enabled', 'dc_challenge_retry_delay_in_millis', 'dh_challenge_retry_delay_in_millis', 'read_stake_factor', 'send_logs_to_origintrail', - 'dh_min_reputation', 'dh_min_stake_amount', + 'dh_min_reputation', 'dh_min_stake_amount', 'houston_password_file_name', 'is_bootstrap_node', 'houston_password', 'reverse_tunnel_address', 'reverse_tunnel_port', 'autoUpdater', 'bugSnag', 'network', 'dataSetStorage', 'dc_holding_time_in_minutes', 'dc_choose_time', 'dc_litigation_interval_in_minutes', 'dh_max_holding_time_in_minutes', 'dh_min_litigation_interval_in_minutes',