Skip to content

Commit

Permalink
Merge pull request #2520 from OriginTrail/v6/prerelease/mainnet
Browse files Browse the repository at this point in the history
Mainnet 6.0.9 Release
  • Loading branch information
zeroxbt authored May 16, 2023
2 parents fdce7bf + c74d313 commit 625dff5
Show file tree
Hide file tree
Showing 23 changed files with 752 additions and 104 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/TEST-bdd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ jobs:
- run: mkdir -p $CUCUMBER_ARTIFACTS_DIR
- run: sudo chmod -R 777 $CUCUMBER_ARTIFACTS_DIR
- run: npm explore dkg-evm-module -- npm run compile;
- name: Cache compiled contracts
uses: actions/cache@v2
with:
path: node_modules/dkg-evm-module/artifacts
key: ${{ runner.os }}-contracts-${{ hashFiles('**/artifacts/contracts') }}
restore-keys: ${{ runner.os }}-contracts-
- run: npm run test:bdd;
- uses: actions/upload-artifact@v2
if: ${{ always() }}
Expand Down
4 changes: 2 additions & 2 deletions dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@

##### [dkg-evm-module](https://www.npmjs.com/package/dkg-evm-module)

- **version**: ^4.0.4
- **version**: ^4.0.5
- **description**: used to import latest ot-node smart contracts abis

##### [dotenv](https://www.npmjs.com/package/dotenv)
Expand Down Expand Up @@ -266,7 +266,7 @@

##### [mysql2](https://www.npmjs.com/package/mysql2)

- **version**: ^2.3.3
- **version**: ^3.3.0
- **description**:

##### [peer-id](https://www.npmjs.com/package/peer-id)
Expand Down
39 changes: 35 additions & 4 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import OtAutoUpdater from './src/modules/auto-updater/implementation/ot-auto-upd
import PullBlockchainShardingTableMigration from './src/migration/pull-sharding-table-migration.js';
import TripleStoreUserConfigurationMigration from './src/migration/triple-store-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';
import MarkOldBlockchainEventsAsProcessedMigration from './src/migration/mark-old-blockchain-events-as-processed-migration.js';
import TripleStoreMetadataMigration from './src/migration/triple-store-metadata-migration.js';
Expand Down Expand Up @@ -53,13 +54,14 @@ class OTNode {
await this.executePrivateAssetsMetadataMigration();
await this.executeRemoveAgreementStartEndTimeMigration();
await this.executeMarkOldBlockchainEventsAsProcessedMigration();
this.executeTripleStoreMetadataMigration();
await this.executeTripleStoreMetadataMigration();
this.executeServiceAgreementsMetadataMigration();

await this.createProfiles();

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

await this.initializeCommandExecutor();
await this.initializeRouters();
Expand Down Expand Up @@ -140,10 +142,11 @@ class OTNode {
this.logger.info('Event emitter initialized');
}

initializeBlockchainEventListenerService() {
async initializeBlockchainEventListenerService() {
try {
const eventListenerService = this.container.resolve('blockchainEventListenerService');
eventListenerService.initialize();
await eventListenerService.initialize();
eventListenerService.startListeningOnEvents();
this.logger.info('Event Listener Service initialized successfully');
} catch (error) {
this.logger.error(
Expand Down Expand Up @@ -320,6 +323,34 @@ class OTNode {
}
}

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

const blockchainModuleManager = this.container.resolve('blockchainModuleManager');
const repositoryModuleManager = this.container.resolve('repositoryModuleManager');
const tripleStoreService = this.container.resolve('tripleStoreService');
const serviceAgreementService = this.container.resolve('serviceAgreementService');
const ualService = this.container.resolve('ualService');

const migration = new ServiceAgreementsMetadataMigration(
'serviceAgreementsMetadataMigration',
this.logger,
this.config,
tripleStoreService,
blockchainModuleManager,
repositoryModuleManager,
serviceAgreementService,
ualService,
);
if (!(await migration.migrationAlreadyExecuted())) {
await migration.migrate();
}
}

async executeRemoveAgreementStartEndTimeMigration() {
if (
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
Expand Down
74 changes: 34 additions & 40 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.7",
"version": "6.0.8",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -97,7 +97,7 @@
"libp2p-tcp": "^0.17.2",
"minimist": "^1.2.7",
"ms": "^2.1.3",
"mysql2": "^2.3.3",
"mysql2": "^3.3.0",
"peer-id": "^0.15.3",
"pino": "^8.4.2",
"pino-pretty": "^9.1.0",
Expand Down
8 changes: 6 additions & 2 deletions scripts/set-ask.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* eslint-disable no-console */
import { ethers } from 'ethers';
import { createRequire } from 'module';
import { NODE_ENVIRONMENTS } from '../src/constants/constants.js';
import {
NODE_ENVIRONMENTS,
TRANSACTION_POLLING_TIMEOUT_MILLIS,
} from '../src/constants/constants.js';
import validateArguments from './utils.js';

const require = createRequire(import.meta.url);
Expand Down Expand Up @@ -32,10 +35,11 @@ async function setAsk(rpcEndpoint, ask, walletPrivateKey, hubContractAddress) {

const askWei = ethers.utils.parseEther(ask);

await profile.setAsk(identityId, askWei, {
const tx = await profile.setAsk(identityId, askWei, {
gasPrice: devEnvironment ? undefined : 8,
gasLimit: 500_000,
});
await provider.waitForTransaction(tx.hash, null, TRANSACTION_POLLING_TIMEOUT_MILLIS);
}

const expectedArguments = ['rpcEndpoint', 'ask', 'privateKey', 'hubContractAddress'];
Expand Down
8 changes: 6 additions & 2 deletions scripts/set-operator-fee.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* eslint-disable no-console */
import { ethers } from 'ethers';
import { createRequire } from 'module';
import { NODE_ENVIRONMENTS } from '../src/constants/constants.js';
import {
NODE_ENVIRONMENTS,
TRANSACTION_POLLING_TIMEOUT_MILLIS,
} from '../src/constants/constants.js';
import validateArguments from './utils.js';

const require = createRequire(import.meta.url);
Expand Down Expand Up @@ -30,10 +33,11 @@ async function setOperatorFee(rpcEndpoint, operatorFee, walletPrivateKey, hubCon

const identityId = await identityStorage.getIdentityId(wallet.address);

stakingContract.setOperatorFee(identityId, operatorFee, {
const tx = await stakingContract.setOperatorFee(identityId, operatorFee, {
gasPrice: process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ? undefined : 8,
gasLimit: 500_000,
});
await provider.waitForTransaction(tx.hash, null, TRANSACTION_POLLING_TIMEOUT_MILLIS);
}

const expectedArguments = ['rpcEndpoint', 'operatorFee', 'privateKey', 'hubContractAddress'];
Expand Down
11 changes: 8 additions & 3 deletions scripts/set-stake.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/* eslint-disable no-console */
import { ethers } from 'ethers';
import { createRequire } from 'module';
import { NODE_ENVIRONMENTS } from '../src/constants/constants.js';
import {
NODE_ENVIRONMENTS,
TRANSACTION_POLLING_TIMEOUT_MILLIS,
} from '../src/constants/constants.js';
import validateArguments from './utils.js';

const require = createRequire(import.meta.url);
Expand Down Expand Up @@ -48,15 +51,17 @@ async function setStake(

const stakeWei = ethers.utils.parseEther(stake);

await tokenContract.increaseAllowance(stakingContractAddress, stakeWei, {
let tx = await tokenContract.increaseAllowance(stakingContractAddress, stakeWei, {
gasPrice: devEnvironment ? undefined : 8,
gasLimit: 500_000,
});
await provider.waitForTransaction(tx.hash, null, TRANSACTION_POLLING_TIMEOUT_MILLIS);
// TODO: Add ABI instead of hard-coded function definition
await stakingContract['addStake(uint72,uint96)'](identityId, stakeWei, {
tx = await stakingContract['addStake(uint72,uint96)'](identityId, stakeWei, {
gasPrice: devEnvironment ? undefined : 1_000,
gasLimit: 500_000,
});
await provider.waitForTransaction(tx.hash, null, TRANSACTION_POLLING_TIMEOUT_MILLIS);
}

const expectedArguments = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SubmitCommitCommand extends EpochCommand {
this.operationIdService = ctx.operationIdService;
this.shardingTableService = ctx.shardingTableService;
this.networkModuleManager = ctx.networkModuleManager;
this.repositoryModuleManager = ctx.repositoryModuleManager;

this.errorType = ERROR_TYPE.COMMIT_PROOF.SUBMIT_COMMIT_ERROR;
}
Expand Down Expand Up @@ -115,6 +116,14 @@ class SubmitCommitCommand extends EpochCommand {
stateIndex,
async (result) => {
if (!result.error) {
that.logger.trace(
`Successfully executed ${command.name} for agreement id: ${agreementId} ` +
`contract: ${contract}, token id: ${tokenId}, keyword: ${keyword}, ` +
`hash function id: ${hashFunctionId}. Retry number ${
COMMAND_RETRIES.SUBMIT_COMMIT - command.retries + 1
}`,
);

const currentEpochStartTime =
Number(agreementData.startTime) + Number(agreementData.epochLength) * epoch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class SubmitProofsCommand extends EpochCommand {

this.blockchainModuleManager = ctx.blockchainModuleManager;
this.operationIdService = ctx.operationIdService;
this.repositoryModuleManager = ctx.repositoryModuleManager;

this.errorType = ERROR_TYPE.COMMIT_PROOF.SUBMIT_PROOFS_ERROR;
}
Expand Down Expand Up @@ -94,6 +95,7 @@ class SubmitProofsCommand extends EpochCommand {
COMMAND_RETRIES.SUBMIT_PROOFS - command.retries + 1
}`,
);

that.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.COMMIT_PROOF.SUBMIT_PROOFS_END,
operationId,
Expand Down
Loading

0 comments on commit 625dff5

Please sign in to comment.