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 Devnet Release v6.0.16 #2724

Merged
merged 22 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
509fd91
Bump semver from 7.3.8 to 7.5.2
dependabot[bot] Jul 14, 2023
a9fe30e
Merge branch 'v6/develop' into dependabot/npm_and_yarn/semver-7.5.2
zeroxbt Jul 19, 2023
eb90e4c
Merge pull request #2707 from OriginTrail/v6/development-network
NZT48 Sep 7, 2023
0dc8658
Merge pull request #2708 from OriginTrail/v6/prerelease/testnet
NZT48 Sep 7, 2023
ca16fcd
Merge pull request #2709 from OriginTrail/v6/release/testnet
branarakic Sep 8, 2023
e4d14c2
Merge pull request #2710 from OriginTrail/v6/prerelease/mainnet
branarakic Sep 8, 2023
039d043
Merge pull request #2626 from OriginTrail/dependabot/npm_and_yarn/sem…
djordjekovac Sep 21, 2023
7484d55
Merge pull request #2711 from OriginTrail/v6/release/mainnet
djordjekovac Sep 21, 2023
b4c495b
Added delay for update finalization in the BDD tests (#2712)
u-hubar Sep 21, 2023
70b5bc1
Added decoding for EVM errors, reworked erro handling for estimateGas…
u-hubar Sep 21, 2023
a97b6a4
Updated command executor pause/resume logic (#2716)
djordjekovac Sep 21, 2023
91d9395
Removed WebSocket Blockchain RPCs from the default configuration,bump…
u-hubar Sep 21, 2023
6a8492e
OriginTrail Devnet Prerelease v6.0.16 (#2718)
u-hubar Sep 21, 2023
5374226
Revert "OriginTrail Devnet Prerelease v6.0.16 (#2718)"
u-hubar Sep 22, 2023
96ce63d
Merge pull request #2720 from OriginTrail/revert-2718-v6/develop
djordjekovac Sep 22, 2023
ab85e74
Merge pull request #2721 from OriginTrail/v6/prerelease/devnet
djordjekovac Sep 22, 2023
5e93746
Authorization middleware logic fixed
djordjekovac Sep 22, 2023
51c7227
Typo fixed
djordjekovac Sep 22, 2023
e028a5a
Update auth middleware to support versioned endpoints
u-hubar Sep 22, 2023
909ef85
Updated authentication middleware to work in the same way as authoriz…
u-hubar Sep 22, 2023
f5ec4f9
Merge pull request #2723 from OriginTrail/v6/authorization-bug-fix
djordjekovac Sep 22, 2023
41a827d
Merge pull request #2722 from OriginTrail/v6/develop
djordjekovac Sep 22, 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
8 changes: 3 additions & 5 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"config": {
"networkId": "otp::testnet",
"hubContractAddress": "0x707233a55bD035C6Bc732196CA4dbffa63CbA169",
"rpcEndpoints": ["wss://lofar.origin-trail.network"],
"rpcEndpoints": ["https://lofar-tm-rpc.origin-trail.network"],
"initialStakeAmount": 50000,
"initialAskAmount": 2
}
Expand Down Expand Up @@ -413,8 +413,7 @@
"hubContractAddress": "0xBbfF7Ea6b2Addc1f38A0798329e12C08f03750A6",
"rpcEndpoints": [
"https://lofar-testnet.origin-trail.network",
"https://lofar-testnet.origintrail.network",
"wss://parachain-testnet-rpc.origin-trail.network"
"https://lofar-testnet.origintrail.network"
]
}
}
Expand Down Expand Up @@ -562,8 +561,7 @@
"hubContractAddress": "0x5fA7916c48Fe6D5F1738d12Ad234b78c90B4cAdA",
"rpcEndpoints": [
"https://astrosat-parachain-rpc.origin-trail.network",
"https://astrosat.origintrail.network/",
"wss://parachain-rpc.origin-trail.network"
"https://astrosat.origintrail.network/"
]
}
}
Expand Down
23 changes: 19 additions & 4 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ class OTNode {

await this.createProfiles();

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

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

Expand Down Expand Up @@ -244,9 +245,11 @@ class OTNode {
async initializeCommandExecutor() {
try {
const commandExecutor = this.container.resolve('commandExecutor');
await commandExecutor.init();
commandExecutor.replay();
await commandExecutor.start();
commandExecutor.pauseQueue();
await commandExecutor.addDefaultCommands();
commandExecutor
.replayOldCommands()
.then(() => this.logger.info('Finished replaying old commands'));
} catch (e) {
this.logger.error(
`Command executor initialization failed. Error message: ${e.message}`,
Expand All @@ -255,6 +258,18 @@ class OTNode {
}
}

resumeCommandExecutor() {
try {
const commandExecutor = this.container.resolve('commandExecutor');
commandExecutor.resumeQueue();
} catch (e) {
this.logger.error(
`Unable to resume command executor queue. Error message: ${e.message}`,
);
this.stop(1);
}
}

async startNetworkModule() {
const networkModuleManager = this.container.resolve('networkModuleManager');
await networkModuleManager.start();
Expand Down
75 changes: 66 additions & 9 deletions package-lock.json

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

4 changes: 2 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.15",
"version": "6.0.16",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -104,7 +104,7 @@
"pino-pretty": "^9.1.0",
"rc": "^1.2.8",
"rolling-rate-limiter": "^0.2.13",
"semver": "^7.3.7",
"semver": "^7.5.2",
"sequelize": "^6.29.0",
"timeout-abort-controller": "^3.0.0",
"toobusy-js": "^0.5.1",
Expand Down
28 changes: 18 additions & 10 deletions src/commands/command-executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class CommandExecutor {
constructor(ctx) {
this.logger = ctx.logger;
this.commandResolver = ctx.commandResolver;
this.started = false;

this.repositoryModuleManager = ctx.repositoryModuleManager;
this.verboseLoggingEnabled = ctx.config.commandExecutorVerboseLoggingEnabled;
Expand All @@ -39,23 +38,32 @@ class CommandExecutor {
* Initialize executor
* @returns {Promise<void>}
*/
async init() {
await Promise.all(PERMANENT_COMMANDS.map((command) => this._startDefaultCommand(command)));
async addDefaultCommands() {
await Promise.all(PERMANENT_COMMANDS.map((command) => this._addDefaultCommand(command)));

if (this.verboseLoggingEnabled) {
this.logger.trace('Command executor has been initialized...');
}
}

/**
* Starts the command executor
* @return {Promise<void>}
* Resumes the command executor queue
*/
resumeQueue() {
if (this.verboseLoggingEnabled) {
this.logger.trace('Command executor queue has been resumed...');
}
this.queue.resume();
}

/**
* Pause the command executor queue
*/
async start() {
this.started = true;
pauseQueue() {
if (this.verboseLoggingEnabled) {
this.logger.trace('Command executor has been started...');
this.logger.trace('Command executor queue has been paused...');
}
this.queue.pause();
}

/**
Expand Down Expand Up @@ -224,7 +232,7 @@ class CommandExecutor {
* @return {Promise<void>}
* @private
*/
async _startDefaultCommand(name) {
async _addDefaultCommand(name) {
await this._delete(name);
const handler = this.commandResolver.resolve(name);
if (!handler) {
Expand Down Expand Up @@ -398,7 +406,7 @@ class CommandExecutor {
* Replays pending commands from the database
* @returns {Promise<void>}
*/
async replay() {
async replayOldCommands() {
this.logger.info('Replay pending/started commands from the database...');
const pendingCommands = await this.repositoryModuleManager.getCommandsWithStatus(
[COMMAND_STATUS.PENDING, COMMAND_STATUS.STARTED, COMMAND_STATUS.REPEATING],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ class SubmitUpdateCommitCommand extends Command {
this.logger.trace(
`Scheduled submit update commit transaction for agreement id: ${agreementId} ` +
`blockchain: ${blockchain} contract: ${contract}, token id: ${tokenId}, ` +
`keyword: ${keyword}, hash function id: ${hashFunctionId}, operationId ${operationId}` +
`transaction queue length: ${transactionQueueLength}.`,
`keyword: ${keyword}, hash function id: ${hashFunctionId}, operationId ${operationId}. ` +
`Transaction queue length: ${transactionQueueLength}.`,
);

return Command.empty();
Expand Down
19 changes: 19 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const STAKE_UINT256_MULTIPLIER_BN = UINT256_MAX_BN.div(500000000);

export const UINT256_UINT32_DIVISOR_BN = UINT256_MAX_BN.div(UINT32_MAX_BN);

export const ZERO_PREFIX = '0x';

export const ZERO_BYTES32 = `0x${'0'.repeat(64)}`;

export const SCHEMA_CONTEXT = 'http://schema.org/';
Expand All @@ -21,6 +23,22 @@ export const COMMITS_DELAY_BETWEEN_NODES_IN_BLOCKS = 2;

export const TRANSACTION_POLLING_TIMEOUT_MILLIS = 50 * 1000;

export const SOLIDITY_ERROR_STRING_PREFIX = '0x08c379a0';

export const SOLIDITY_PANIC_CODE_PREFIX = '0x4e487b71';

export const SOLIDITY_PANIC_REASONS = {
0x1: 'Assertion error',
0x11: 'Arithmetic operation underflowed or overflowed outside of an unchecked block',
0x12: 'Division or modulo division by zero',
0x21: 'Tried to convert a value into an enum, but the value was too big or negative',
0x22: 'Incorrectly encoded storage byte array',
0x31: '.pop() was called on an empty array',
0x32: 'Array accessed at an out-of-bounds or negative index',
0x41: 'Too much memory was allocated, or an array was created that is too large',
0x51: 'Called a zero-initialized variable of internal function type',
};

export const LIBP2P_KEY_DIRECTORY = 'libp2p';

export const LIBP2P_KEY_FILENAME = 'privateKey';
Expand All @@ -38,6 +56,7 @@ export const TRIPLE_STORE_CONNECT_RETRY_FREQUENCY = 10;
export const MAX_FILE_SIZE = 2621440;

export const GET_STATES = { LATEST: 'LATEST', FINALIZED: 'LATEST_FINALIZED' };

export const BYTES_IN_KILOBYTE = 1024;

export const BYTES_IN_MEGABYTE = BYTES_IN_KILOBYTE * BYTES_IN_KILOBYTE;
Expand Down
Loading