Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OriginTrail Mainnet Prerelease v6.0.18 #2767

Merged
merged 40 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
45d2b49
Merge pull request #2736 from OriginTrail/v6/prerelease/mainnet
djordjekovac Oct 5, 2023
386b109
Transform telemtry-service to module (#2737)
Mihajlo-Pavlovic Oct 20, 2023
3f610e0
Added error handling for commits/proofs commands, added error handlin…
u-hubar Nov 3, 2023
4bcbf68
Bumped version to 6.0.17
u-hubar Nov 3, 2023
d556a6d
Added missing awaits for handleError
u-hubar Nov 3, 2023
a4d80c7
Merge pull request #2741 from OriginTrail/fix/transactions-timeout
u-hubar Nov 3, 2023
48df418
Merge pull request #2742 from OriginTrail/v6/release/mainnet
NZT48 Nov 3, 2023
5d29137
Merge pull request #2745 from OriginTrail/v6/develop
NZT48 Nov 3, 2023
3501e75
Merge pull request #2746 from OriginTrail/v6/prerelease/devnet
NZT48 Nov 3, 2023
be3e311
Merge pull request #2747 from OriginTrail/v6/development-network
NZT48 Nov 3, 2023
bb9ef43
Merge pull request #2748 from OriginTrail/v6/prerelease/testnet
NZT48 Nov 3, 2023
87fdddc
Implemented Fallback RPC Provider, changed the way of handling commit…
u-hubar Nov 3, 2023
7658494
Merge pull request #2749 from OriginTrail/improvement/fallback-rpc-pr…
NZT48 Nov 3, 2023
b51d56a
Bumped version to 6.0.18
u-hubar Nov 3, 2023
221ff10
Merge pull request #2750 from OriginTrail/fallback-rpc-provider/versi…
NZT48 Nov 3, 2023
faead07
Merge branch 'v6/prerelease/devnet' into v6/develop
NZT48 Nov 3, 2023
76354cf
Merge pull request #2751 from OriginTrail/v6/develop
NZT48 Nov 3, 2023
ed4287c
Merge pull request #2754 from OriginTrail/v6/prerelease/devnet
NZT48 Nov 3, 2023
7bc8b18
Fixed error message check
u-hubar Nov 3, 2023
e3d3917
Merge pull request #2755 from OriginTrail/fix/cp-error-handling
NZT48 Nov 3, 2023
8ab753f
Merge branch 'v6/prerelease/devnet' into v6/develop
NZT48 Nov 3, 2023
f5b69ec
Merge pull request #2756 from OriginTrail/v6/develop
NZT48 Nov 3, 2023
026799e
Merge pull request #2757 from OriginTrail/v6/prerelease/devnet
NZT48 Nov 3, 2023
d26c83c
Merge branch 'v6/prerelease/testnet' into v6/development-network
NZT48 Nov 3, 2023
ca7c169
Merge pull request #2758 from OriginTrail/v6/development-network
NZT48 Nov 3, 2023
fcc765c
Merge pull request #2759 from OriginTrail/v6/prerelease/testnet
NZT48 Nov 3, 2023
98cd337
Merge branch 'v6/release/testnet' into v6/prerelease/testnet
NZT48 Nov 4, 2023
0d1519b
Merge pull request #2760 from OriginTrail/v6/prerelease/testnet
NZT48 Nov 4, 2023
893f310
Fix KA validation on publish/update to check if assertion ID is 0x0, …
u-hubar Nov 6, 2023
edeb4b4
Removed hotfix suffix from the version
u-hubar Nov 6, 2023
b80eb28
Updated provider debugging
u-hubar Nov 6, 2023
1ee2d09
Only try to get contract instance for call/estimateGas inside provide…
u-hubar Nov 6, 2023
702aa54
Turned off provider debugging
u-hubar Nov 6, 2023
979772f
Merge pull request #2761 from OriginTrail/fix/fallback-provider-init
NZT48 Nov 6, 2023
d2c1df3
Merge pull request #2763 from OriginTrail/v6/develop
NZT48 Nov 6, 2023
77a8851
Merge pull request #2764 from OriginTrail/v6/prerelease/devnet
NZT48 Nov 6, 2023
3a31475
Merge branch 'v6/prerelease/testnet' into v6/development-network
NZT48 Nov 6, 2023
c432586
Merge pull request #2765 from OriginTrail/v6/development-network
NZT48 Nov 6, 2023
3dae7bd
Merge branch 'v6/release/testnet' into v6/prerelease/testnet
NZT48 Nov 6, 2023
da02b1e
Merge pull request #2766 from OriginTrail/v6/prerelease/testnet
NZT48 Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 58 additions & 22 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@
"config": {
"networkId": "otp::testnet",
"hubContractAddress": "0x707233a55bD035C6Bc732196CA4dbffa63CbA169",
"rpcEndpoints": ["https://lofar-tm-rpc.origin-trail.network"],
"rpcEndpoints": [
"https://lofar-tm-rpc.origin-trail.network",
"https://lofar.origintrail.network/"
],
"initialStakeAmount": 50000,
"initialAskAmount": 2
}
Expand Down Expand Up @@ -166,17 +169,25 @@
}
}
}
},
"telemetry": {
"enabled": true,
"implementation": {
"ot-telemetry": {
"enabled": true,
"package": "./telemetry/implementation/ot-telemetry.js",
"config": {
"sendTelemetryData": false,
"signalingServerUrl": "null"
}
}
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "info",
"telemetry": {
"enabled": true,
"sendTelemetryData": false,
"signalingServerUrl": "null"
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -301,17 +312,25 @@
"config": {}
}
}
},
"telemetry": {
"enabled": true,
"implementation": {
"ot-telemetry": {
"enabled": true,
"package": "./telemetry/implementation/ot-telemetry.js",
"config": {
"sendTelemetryData": false,
"signalingServerUrl": "null"
}
}
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"telemetry": {
"enabled": true,
"sendTelemetryData": false,
"signalingServerUrl": "null"
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -448,17 +467,25 @@
"config": {}
}
}
},
"telemetry": {
"enabled": true,
"implementation": {
"ot-telemetry": {
"enabled": true,
"package": "./telemetry/implementation/ot-telemetry.js",
"config": {
"sendTelemetryData": true,
"signalingServerUrl": "https://testnet-signaling.origin-trail.network/signal"
}
}
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"telemetry": {
"enabled": true,
"sendTelemetryData": true,
"signalingServerUrl": "https://testnet-signaling.origin-trail.network/signal"
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down Expand Up @@ -561,7 +588,8 @@
"hubContractAddress": "0x5fA7916c48Fe6D5F1738d12Ad234b78c90B4cAdA",
"rpcEndpoints": [
"https://astrosat-parachain-rpc.origin-trail.network",
"https://astrosat.origintrail.network/"
"https://astrosat.origintrail.network/",
"https://astrosat-2.origintrail.network/"
]
}
}
Expand Down Expand Up @@ -596,17 +624,25 @@
"config": {}
}
}
},
"telemetry": {
"enabled": true,
"implementation": {
"ot-telemetry": {
"enabled": true,
"package": "./telemetry/implementation/ot-telemetry.js",
"config": {
"sendTelemetryData": true,
"signalingServerUrl": "https://mainnet-signaling.origin-trail.network/signal"
}
}
}
}
},
"maximumAssertionSizeInKb": 2500,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
"telemetry": {
"enabled": true,
"sendTelemetryData": true,
"signalingServerUrl": "https://mainnet-signaling.origin-trail.network/signal"
},
"auth": {
"ipBasedAuthEnabled": true,
"tokenBasedAuthEnabled": false,
Expand Down
54 changes: 37 additions & 17 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import OtnodeUpdateCommand from './src/commands/common/otnode-update-command.js'
import OtAutoUpdater from './src/modules/auto-updater/implementation/ot-auto-updater.js';
import PullBlockchainShardingTableMigration from './src/migration/pull-sharding-table-migration.js';
import TripleStoreUserConfigurationMigration from './src/migration/triple-store-user-configuration-migration.js';
import TelemetryModuleUserConfigurationMigration from './src/migration/telemetry-module-user-configuration-migration.js';
import PrivateAssetsMetadataMigration from './src/migration/private-assets-metadata-migration.js';
import ServiceAgreementsMetadataMigration from './src/migration/service-agreements-metadata-migration.js';
import RemoveAgreementStartEndTimeMigration from './src/migration/remove-agreement-start-end-time-migration.js';
Expand All @@ -36,6 +37,7 @@ class OTNode {
await this.checkForUpdate();
await this.removeUpdateFile();
await this.executeTripleStoreUserConfigurationMigration();
await this.executeTelemetryModuleUserConfigurationMigration();
this.logger.info(' ██████╗ ████████╗███╗ ██╗ ██████╗ ██████╗ ███████╗');
this.logger.info('██╔═══██╗╚══██╔══╝████╗ ██║██╔═══██╗██╔══██╗██╔════╝');
this.logger.info('██║ ██║ ██║ ██╔██╗ ██║██║ ██║██║ ██║█████╗');
Expand Down Expand Up @@ -65,11 +67,11 @@ class OTNode {

await this.initializeCommandExecutor();
await this.initializeShardingTableService();
await this.initializeTelemetryInjectionService();
await this.initializeBlockchainEventListenerService();

await this.initializeRouters();
await this.startNetworkModule();
this.startTelemetryModule();
this.resumeCommandExecutor();
this.logger.info('Node is up and running!');
}
Expand Down Expand Up @@ -275,6 +277,21 @@ class OTNode {
await networkModuleManager.start();
}

startTelemetryModule() {
const telemetryModuleManager = this.container.resolve('telemetryModuleManager');
const repositoryModuleManager = this.container.resolve('repositoryModuleManager');
telemetryModuleManager.listenOnEvents((eventData) => {
repositoryModuleManager.createEventRecord(
eventData.operationId,
eventData.lastEvent,
eventData.timestamp,
eventData.value1,
eventData.value2,
eventData.value3,
);
});
}

async executePrivateAssetsMetadataMigration() {
if (
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
Expand Down Expand Up @@ -305,6 +322,25 @@ class OTNode {
}
}

async executeTelemetryModuleUserConfigurationMigration() {
if (
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
process.env.NODE_ENV === NODE_ENVIRONMENTS.TEST
)
return;

const migration = new TelemetryModuleUserConfigurationMigration(
'telemetryModuleUserConfigurationMigration',
this.logger,
this.config,
);
if (!(await migration.migrationAlreadyExecuted())) {
await migration.migrate();
this.logger.info('Node will now restart!');
this.stop(1);
}
}

async executeTripleStoreUserConfigurationMigration() {
if (
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
Expand Down Expand Up @@ -474,22 +510,6 @@ class OTNode {
}
}

async initializeTelemetryInjectionService() {
if (this.config.telemetry.enabled) {
try {
const telemetryHubModuleManager = this.container.resolve(
'telemetryInjectionService',
);
telemetryHubModuleManager.initialize();
this.logger.info('Telemetry Injection Service initialized successfully');
} catch (e) {
this.logger.error(
`Telemetry hub module initialization failed. Error message: ${e.message}`,
);
}
}
}

async removeUpdateFile() {
const updateFilePath = this.fileService.getUpdateFilePath();
await this.fileService.removeFile(updateFilePath).catch((error) => {
Expand Down
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.0.16",
"version": "6.0.18",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
60 changes: 33 additions & 27 deletions src/commands/common/send-telemetry-command.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios from 'axios';
import { createRequire } from 'module';
import Command from '../command.js';
import { SEND_TELEMETRY_COMMAND_FREQUENCY_MINUTES } from '../../constants/constants.js';
Expand All @@ -11,45 +10,42 @@ class SendTelemetryCommand extends Command {
super(ctx);
this.logger = ctx.logger;
this.config = ctx.config;
this.telemetryInjectionService = ctx.telemetryInjectionService;
this.networkModuleManager = ctx.networkModuleManager;
this.blockchainModuleManager = ctx.blockchainModuleManager;
this.repositoryModuleManager = ctx.repositoryModuleManager;
this.telemetryModuleManager = ctx.telemetryModuleManager;
}

/**
* Performs code update by fetching new code from github repo
* @param command
*/
async execute() {
if (!this.config.telemetry.enabled || !this.config.telemetry.sendTelemetryData) {
if (
!this.config.modules.telemetry.enabled ||
!this.telemetryModuleManager.getModuleConfiguration().sendTelemetryData
) {
return Command.empty();
}

try {
const events = await this.telemetryInjectionService.getUnpublishedEvents();
const signalingMessage = {
nodeData: {
version: pjson.version,
identity: this.networkModuleManager.getPeerId().toB58String(),
hostname: this.config.hostname,
operational_wallet: this.blockchainModuleManager.getPublicKey(),
management_wallet: this.blockchainModuleManager.getManagementKey(),
triple_store: this.config.modules.tripleStore.defaultImplementation,
auto_update_enabled: this.config.modules.autoUpdater.enabled,
multiaddresses: this.networkModuleManager.getMultiaddrs(),
},
events: events || [],
};
const config = {
method: 'post',
url: this.config.telemetry.signalingServerUrl,
headers: {
'Content-Type': 'application/json',
},
data: JSON.stringify(signalingMessage),
const events = (await this.getUnpublishedEvents()) || [];
const nodeData = {
version: pjson.version,
identity: this.networkModuleManager.getPeerId().toB58String(),
hostname: this.config.hostname,
operational_wallet: this.blockchainModuleManager.getPublicKey(),
management_wallet: this.blockchainModuleManager.getManagementKey(),
triple_store: this.config.modules.tripleStore.defaultImplementation,
auto_update_enabled: this.config.modules.autoUpdater.enabled,
multiaddresses: this.networkModuleManager.getMultiaddrs(),
};
const response = await axios(config);
if (response.status === 200 && events?.length > 0) {
await this.telemetryInjectionService.removePublishedEvents(events);
const isDataSuccessfullySent = await this.telemetryModuleManager.sendTelemetryData(
nodeData,
events,
);
if (isDataSuccessfullySent && events?.length > 0) {
await this.removePublishedEvents(events);
}
} catch (e) {
await this.handleError(e);
Expand Down Expand Up @@ -83,6 +79,16 @@ class SendTelemetryCommand extends Command {
Object.assign(command, map);
return command;
}

async getUnpublishedEvents() {
return this.repositoryModuleManager.getUnpublishedEvents();
}

async removePublishedEvents(events) {
const ids = events.map((event) => event.id);

await this.repositoryModuleManager.destroyEvents(ids);
}
}

export default SendTelemetryCommand;
9 changes: 7 additions & 2 deletions src/commands/common/validate-asset-command.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import Command from '../command.js';
import { ERROR_TYPE, OPERATION_ID_STATUS, LOCAL_STORE_TYPES } from '../../constants/constants.js';
import {
ERROR_TYPE,
OPERATION_ID_STATUS,
LOCAL_STORE_TYPES,
ZERO_BYTES32,
} from '../../constants/constants.js';

class ValidateAssetCommand extends Command {
constructor(ctx) {
Expand Down Expand Up @@ -43,7 +48,7 @@ class ValidateAssetCommand extends Command {
tokenId,
);
}
if (!blockchainAssertionId) {
if (!blockchainAssertionId || blockchainAssertionId === ZERO_BYTES32) {
return Command.retry();
}
const cachedData = await this.operationIdService.getCachedOperationIdData(operationId);
Expand Down
Loading