Skip to content

Commit

Permalink
Merge pull request #2891 from OriginTrail/v6/prerelease/testnet
Browse files Browse the repository at this point in the history
OriginTrail Testnet Release v6.1.3
  • Loading branch information
NZT48 authored Jan 16, 2024
2 parents e3dc870 + 0c7ec93 commit 3a5a193
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 4 additions & 6 deletions src/commands/protocols/common/submit-commit-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/commands/protocols/common/submit-proofs-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
18 changes: 16 additions & 2 deletions src/modules/blockchain/implementation/gnosis/gnosis-service.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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;

0 comments on commit 3a5a193

Please sign in to comment.