Skip to content

Commit

Permalink
Merge pull request #2686 from OriginTrail/sync-nodes/v6.0.23
Browse files Browse the repository at this point in the history
OriginTrail Release v6.0.13 for Sync Nodes
  • Loading branch information
u-hubar authored Aug 24, 2023
2 parents 6d9d9c9 + 3854ce7 commit 01f5027
Show file tree
Hide file tree
Showing 36 changed files with 443 additions and 150 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ name: checks

on:
pull_request:
branches:
- v6/develop
types: [opened, reopened, synchronize]

env:
REPOSITORY_PASSWORD: password
Expand Down
4 changes: 4 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "info",
Expand Down Expand Up @@ -305,6 +306,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down Expand Up @@ -455,6 +457,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down Expand Up @@ -606,6 +609,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down
6 changes: 6 additions & 0 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class OTNode {

await this.initializeCommandExecutor();
await this.initializeRouters();
await this.startNetworkModule();
this.logger.info('Node is up and running!');
}

Expand Down Expand Up @@ -257,6 +258,11 @@ class OTNode {
}
}

async startNetworkModule() {
const networkModuleManager = this.container.resolve('networkModuleManager');
await networkModuleManager.start();
}

async executePrivateAssetsMetadataMigration() {
if (
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.0.22",
"version": "6.0.23",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand All @@ -12,6 +12,7 @@
"lint-staged": "lint-staged",
"create-account-mapping-signature": "node tools/ot-parachain-account-mapping/create-account-mapping-signature.js ",
"start:local_blockchain": "npm explore dkg-evm-module -- npm run dev",
"kill:local_blockchain": "npx kill-port 8545",
"test:bdd": "cucumber-js --fail-fast --format progress --format-options '{\"colorsEnabled\": true}' test/bdd/ --import test/bdd/steps/ --exit",
"test:unit": "nyc --all mocha --exit $(find test/unit -name '*.js')",
"test:modules": "nyc --all mocha --exit $(find test/modules -name '*.js')",
Expand Down Expand Up @@ -74,7 +75,7 @@
"axios": "^0.27.2",
"cors": "^2.8.5",
"deep-extend": "^0.6.0",
"dkg-evm-module": "^4.0.5",
"dkg-evm-module": "^4.0.7",
"dotenv": "^16.0.1",
"ethers": "^5.7.2",
"express": "^4.18.1",
Expand Down
7 changes: 5 additions & 2 deletions src/commands/local-store/local-store-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,11 @@ class LocalStoreCommand extends Command {
await this.commandExecutor.add({
name: 'deletePendingStateCommand',
sequence: [],
delay: updateCommitWindowDuration * 1000,
data: { ...command.data, repository: PENDING_STORAGE_REPOSITORIES.PRIVATE },
delay: (updateCommitWindowDuration + 60) * 1000,
data: {
...command.data,
assertionId: cachedData.public.assertionId,
},
transactional: false,
});
}
Expand Down
17 changes: 14 additions & 3 deletions src/commands/protocols/common/handle-protocol-message-command.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Command from '../../command.js';
import { NETWORK_MESSAGE_TYPES } from '../../../constants/constants.js';
import { BYTES_IN_KILOBYTE, NETWORK_MESSAGE_TYPES } from '../../../constants/constants.js';

class HandleProtocolMessageCommand extends Command {
constructor(ctx) {
Expand Down Expand Up @@ -127,6 +127,18 @@ class HandleProtocolMessageCommand extends Command {
this.blockchainModuleManager.getR0(blockchain),
getAsk(),
]);
const blockchainAssertionSizeInKb = blockchainAssertionSize / BYTES_IN_KILOBYTE;
if (blockchainAssertionSizeInKb > this.config.maximumAssertionSizeInKb) {
this.logger.warn(
`The size of the received assertion exceeds the maximum limit allowed.. Maximum allowed assertion size in kb: ${this.config.maximumAssertionSizeInKb}, assertion size read from blockchain in kb: ${blockchainAssertionSizeInKb}`,
);
return {
errorMessage:
'The size of the received assertion exceeds the maximum limit allowed.',
agreementId,
agreementData,
};
}

const now = await this.blockchainModuleManager.getBlockchainTimestamp(blockchain);

Expand All @@ -143,8 +155,7 @@ class HandleProtocolMessageCommand extends Command {
.mul(epochsLeft)
.mul(blockchainAssertionSize);

const serviceAgreementBid = this.blockchainModuleManager
.toBigNumber(blockchain, agreementData.tokenAmount)
const serviceAgreementBid = agreementData.tokenAmount
.add(agreementData.updateTokenAmount)
.mul(1024)
.div(divisor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,24 @@ class HandleGetInitCommand extends HandleProtocolMessageCommand {
blockchain,
contract,
tokenId,
assertionId,
);
}

for (const repository of [
TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT,
TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY,
]) {
if (assertionExists) {
break;
if (!assertionExists) {
for (const repository of [
TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT,
TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY,
]) {
// eslint-disable-next-line no-await-in-loop
assertionExists = await this.tripleStoreService.assertionExists(
repository,
assertionId,
);
if (assertionExists) {
break;
}
}

// eslint-disable-next-line no-await-in-loop
assertionExists = await this.tripleStoreService.assertionExists(
repository,
assertionId,
);
}

await this.operationIdService.updateOperationIdStatus(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
OPERATION_ID_STATUS.GET.GET_REMOTE_START,
);

let nquads;
if (
state !== GET_STATES.FINALIZED &&
blockchain != null &&
Expand All @@ -37,26 +38,24 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
blockchain,
contract,
tokenId,
assertionId,
operationId,
);
if (cachedAssertion?.public?.assertion?.length) {
return {
messageType: NETWORK_MESSAGE_TYPES.RESPONSES.ACK,
messageData: { nquads: cachedAssertion.public.assertion },
};
nquads = cachedAssertion.public.assertion;
}
}

let nquads;
for (const repository of [
TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT,
TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY,
]) {
// eslint-disable-next-line no-await-in-loop
nquads = await this.tripleStoreService.getAssertion(repository, assertionId);

if (nquads.length) {
break;
if (!nquads?.length) {
for (const repository of [
TRIPLE_STORE_REPOSITORIES.PUBLIC_CURRENT,
TRIPLE_STORE_REPOSITORIES.PUBLIC_HISTORY,
]) {
// eslint-disable-next-line no-await-in-loop
nquads = await this.tripleStoreService.getAssertion(repository, assertionId);
if (nquads.length) {
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ class GetAssertionIdCommand extends Command {
}
}

return this.continueSequence(
{ ...command.data, state: assertionId, assertionId },
command.sequence,
);
return this.continueSequence({ ...command.data, state, assertionId }, command.sequence);
}

async handleError(operationId, errorMessage, errorType) {
Expand Down
Loading

0 comments on commit 01f5027

Please sign in to comment.