From c6b723421d4e13c991989a399e373f808043a8ee Mon Sep 17 00:00:00 2001 From: Djordje Kovacevic Date: Tue, 16 Jan 2024 12:04:50 +0100 Subject: [PATCH 1/3] Version updated, update commit delay between nodes set to 5, updated error messages for transaction sending --- package-lock.json | 4 ++-- package.json | 2 +- src/commands/protocols/common/submit-commit-command.js | 10 ++++------ src/commands/protocols/common/submit-proofs-command.js | 8 ++++---- .../update/receiver/submit-update-commit-command.js | 4 ++-- .../v1.0.0/v1-0-0-handle-update-request-command.js | 2 +- src/constants/constants.js | 2 +- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 22def46834..8e19c69950 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "6.1.3+hotfix.1", + "version": "6.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "6.1.3+hotfix.1", + "version": "6.1.3", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", diff --git a/package.json b/package.json index 8dcd03151d..a47456623b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "6.1.3+hotfix.1", + "version": "6.1.3", "description": "OTNode V6", "main": "index.js", "type": "module", diff --git a/src/commands/protocols/common/submit-commit-command.js b/src/commands/protocols/common/submit-commit-command.js index 61bdc85712..d7a703d95e 100644 --- a/src/commands/protocols/common/submit-commit-command.js +++ b/src/commands/protocols/common/submit-commit-command.js @@ -131,12 +131,11 @@ class SubmitCommitCommand extends Command { `Retry number: ${COMMAND_RETRIES.SUBMIT_COMMIT - command.retries + 1}.`, ); this.operationIdService.emitChangeEvent( - ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_SEND_TX_ERROR, + OPERATION_ID_STATUS.FAILED, sendSubmitCommitTransactionOperationId, blockchain, error.message, - this.errorType, - operationId, + ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_SEND_TX_ERROR, ); let newGasPrice; if ( @@ -178,12 +177,11 @@ class SubmitCommitCommand extends Command { } else { msgBase = 'Node has already submitted commit. Finishing'; this.operationIdService.emitChangeEvent( - ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_SEND_TX_ERROR, + OPERATION_ID_STATUS.FAILED, sendSubmitCommitTransactionOperationId, blockchain, msgBase, - this.errorType, - operationId, + ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_SEND_TX_ERROR, ); } diff --git a/src/commands/protocols/common/submit-proofs-command.js b/src/commands/protocols/common/submit-proofs-command.js index a6e30ae014..2f77239ff4 100644 --- a/src/commands/protocols/common/submit-proofs-command.js +++ b/src/commands/protocols/common/submit-proofs-command.js @@ -181,11 +181,11 @@ class SubmitProofsCommand extends Command { `Retry number: ${COMMAND_RETRIES.SUBMIT_PROOFS - command.retries + 1}.`, ); this.operationIdService.emitChangeEvent( - ERROR_TYPE.COMMIT_PROOF.SUBMIT_PROOFS_SEND_TX_ERROR, + OPERATION_ID_STATUS.FAILED, sendSubmitProofsTransactionOperationId, blockchain, error.message, - this.errorType, + ERROR_TYPE.COMMIT_PROOF.SUBMIT_PROOFS_SEND_TX_ERROR, ); let newGasPrice; if ( @@ -226,11 +226,11 @@ class SubmitProofsCommand extends Command { } else { msgBase = 'Node has already sent proof. Finishing'; this.operationIdService.emitChangeEvent( - ERROR_TYPE.COMMIT_PROOF.SUBMIT_PROOFS_SEND_TX_ERROR, + OPERATION_ID_STATUS.FAILED, sendSubmitProofsTransactionOperationId, blockchain, msgBase, - this.errorType, + ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_SEND_TX_ERROR, ); } diff --git a/src/commands/protocols/update/receiver/submit-update-commit-command.js b/src/commands/protocols/update/receiver/submit-update-commit-command.js index 97fd7dd87f..64d81de6d2 100644 --- a/src/commands/protocols/update/receiver/submit-update-commit-command.js +++ b/src/commands/protocols/update/receiver/submit-update-commit-command.js @@ -116,11 +116,11 @@ class SubmitUpdateCommitCommand extends Command { }.`, ); this.operationIdService.emitChangeEvent( - ERROR_TYPE.COMMIT_PROOF.SUBMIT_UPDATE_COMMIT_SEND_TX_ERROR, + OPERATION_ID_STATUS.FAILED, sendSubmitUpdateCommitTransactionOperationId, blockchain, error.message, - this.errorType, + ERROR_TYPE.COMMIT_PROOF.SUBMIT_UPDATE_COMMIT_SEND_TX_ERROR, ); let newGasPrice; if ( diff --git a/src/commands/protocols/update/receiver/v1.0.0/v1-0-0-handle-update-request-command.js b/src/commands/protocols/update/receiver/v1.0.0/v1-0-0-handle-update-request-command.js index c02ae88649..3f82ad11df 100644 --- a/src/commands/protocols/update/receiver/v1.0.0/v1-0-0-handle-update-request-command.js +++ b/src/commands/protocols/update/receiver/v1.0.0/v1-0-0-handle-update-request-command.js @@ -131,7 +131,7 @@ class HandleUpdateRequestCommand extends HandleProtocolMessageCommand { // wait for 5 blocks for first batch to send commits const commitsBlockDuration = blockTime * COMMIT_BLOCK_DURATION_IN_BLOCKS; const commitBlock = Math.floor(rank / finalizationCommitsNumber); - // put 2 blocks delay between nodes if they are not in first batch + // put 5 blocks delay between nodes if they are not in first batch const nextNodeDelay = commitBlock === 0 ? 0 diff --git a/src/constants/constants.js b/src/constants/constants.js index da56d038a7..6a0d897a6c 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -29,7 +29,7 @@ export const PRIVATE_ASSERTION_PREDICATE = export const COMMIT_BLOCK_DURATION_IN_BLOCKS = 5; -export const COMMITS_DELAY_BETWEEN_NODES_IN_BLOCKS = 2; +export const COMMITS_DELAY_BETWEEN_NODES_IN_BLOCKS = 5; export const TRANSACTION_POLLING_TIMEOUT_MILLIS = 300 * 1000; From 83e321672fd353ba6c411cd0a5e2737adcbd2547 Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 16 Jan 2024 12:57:15 +0100 Subject: [PATCH 2/3] Set Gsnosis default gas price to 2 Gwei --- .../implementation/gnosis/gnosis-service.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/modules/blockchain/implementation/gnosis/gnosis-service.js b/src/modules/blockchain/implementation/gnosis/gnosis-service.js index a265283c0a..92ba352f81 100644 --- a/src/modules/blockchain/implementation/gnosis/gnosis-service.js +++ b/src/modules/blockchain/implementation/gnosis/gnosis-service.js @@ -26,9 +26,23 @@ class GnosisService extends Web3Service { this.logger.debug(`Gas price on Gnosis: ${gasPrice}`); return gasPrice; } catch (error) { - return undefined; + this.logger.debug( + `Failed to fetch the gas price from the Gnosis: ${error}. Using default value: 2 Gwei.`, + ); + this.convertToWei(2, 'gwei'); } } + + async healthCheck() { + try { + const blockNumber = await this.getBlockNumber(); + if (blockNumber) return true; + } catch (e) { + this.logger.error(`Error on checking Gnosis blockchain. ${e}`); + return false; + } + return false; + } } export default GnosisService; From 87e4dfadd9aed7581583aa603e76153e3a1259cc Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Tue, 16 Jan 2024 13:17:26 +0100 Subject: [PATCH 3/3] Turn defualt gas price value to const, turn log to warn --- src/constants/constants.js | 2 ++ .../blockchain/implementation/gnosis/gnosis-service.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/constants/constants.js b/src/constants/constants.js index da56d038a7..16d0f3588e 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -188,6 +188,8 @@ export const COMMAND_TX_GAS_INCREASE_FACTORS = { SUBMIT_PROOFS: 1.2, }; +export const GNOSIS_DEFAULT_GAS_PRICE = 2; + export const WEBSOCKET_PROVIDER_OPTIONS = { reconnect: { auto: true, diff --git a/src/modules/blockchain/implementation/gnosis/gnosis-service.js b/src/modules/blockchain/implementation/gnosis/gnosis-service.js index 92ba352f81..089ad52f81 100644 --- a/src/modules/blockchain/implementation/gnosis/gnosis-service.js +++ b/src/modules/blockchain/implementation/gnosis/gnosis-service.js @@ -1,6 +1,6 @@ import axios from 'axios'; import Web3Service from '../web3-service.js'; -import { BLOCK_TIME_MILLIS } from '../../../../constants/constants.js'; +import { BLOCK_TIME_MILLIS, GNOSIS_DEFAULT_GAS_PRICE } from '../../../../constants/constants.js'; class GnosisService extends Web3Service { constructor(ctx) { @@ -26,10 +26,10 @@ class GnosisService extends Web3Service { this.logger.debug(`Gas price on Gnosis: ${gasPrice}`); return gasPrice; } catch (error) { - this.logger.debug( - `Failed to fetch the gas price from the Gnosis: ${error}. Using default value: 2 Gwei.`, + this.logger.warn( + `Failed to fetch the gas price from the Gnosis: ${error}. Using default value: ${GNOSIS_DEFAULT_GAS_PRICE} Gwei.`, ); - this.convertToWei(2, 'gwei'); + this.convertToWei(GNOSIS_DEFAULT_GAS_PRICE, 'gwei'); } }