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..9afa6ed6b9 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; @@ -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 a265283c0a..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,9 +26,23 @@ class GnosisService extends Web3Service { this.logger.debug(`Gas price on Gnosis: ${gasPrice}`); return gasPrice; } catch (error) { - return undefined; + this.logger.warn( + `Failed to fetch the gas price from the Gnosis: ${error}. Using default value: ${GNOSIS_DEFAULT_GAS_PRICE} Gwei.`, + ); + this.convertToWei(GNOSIS_DEFAULT_GAS_PRICE, '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;