Skip to content

Commit

Permalink
Merge pull request #2448 from OriginTrail/v6/prerelease/mainnet
Browse files Browse the repository at this point in the history
Mainnet 6.0.6 Release
  • Loading branch information
zeroxbt authored Apr 18, 2023
2 parents a23bdcb + face8c1 commit bd4ab99
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 36 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.0.5",
"version": "6.0.6",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class CalculateProofsCommand extends EpochCommand {
contract,
tokenId,
epoch,
stateIndex,
);

const assertion = await this.tripleStoreService.getAssertion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class EpochCheckCommand extends EpochCommand {
blockchain,
agreementId,
epoch,
stateIndex,
);
if (!commitWindowOpen) {
this.logger.trace(
Expand Down
16 changes: 9 additions & 7 deletions src/commands/protocols/publish/receiver/submit-commit-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class SubmitCommitCommand extends EpochCommand {
keyword,
hashFunctionId,
epoch,
stateIndex,
async (result) => {
if (!result.error) {
const currentEpochStartTime =
Expand Down Expand Up @@ -142,18 +143,19 @@ class SubmitCommitCommand extends EpochCommand {
`Scheduling calculateProofsCommand for agreement id: ${agreementId} in ${delay} seconds`,
);

await that.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.COMMIT_PROOF.SUBMIT_COMMIT_END,
operationId,
agreementId,
epoch,
);

await that.commandExecutor.add({
name: 'calculateProofsCommand',
delay: delay * 1000,
data: { ...command.data, proofWindowStartTime },
transactional: false,
});
that.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.COMMIT_PROOF.SUBMIT_COMMIT_END,
operationId,
agreementId,
epoch,
);
} else if (command.retries - 1 === 0) {
await that.scheduleNextEpochCheck(
blockchain,
Expand All @@ -168,7 +170,7 @@ class SubmitCommitCommand extends EpochCommand {
);
const errorMessage = `Failed executing submit commit command, maximum number of retries reached. Error: ${result.error.message}. Scheduling next epoch check.`;
that.logger.error(errorMessage);
that.operationIdService.emitChangeEvent(
await that.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.FAILED,
operationId,
errorMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class SubmitProofsCommand extends EpochCommand {
epoch,
proof,
leaf,
stateIndex,
async (result) => {
if (!result.error) {
that.logger.trace(
Expand Down
21 changes: 14 additions & 7 deletions src/modules/blockchain/blockchain-module-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,26 +175,27 @@ class BlockchainModuleManager extends BaseModuleManager {
return this.callImplementationFunction(blockchain, 'convertFromWei', [value, toUnit]);
}

async isCommitWindowOpen(blockchain, agreementId, epoch) {
async isCommitWindowOpen(blockchain, agreementId, epoch, stateIndex) {
return this.callImplementationFunction(blockchain, 'isCommitWindowOpen', [
agreementId,
epoch,
stateIndex,
]);
}

async isUpdateCommitWindowOpen(blockchain, agreementId, epoch, stateIndex) {
async isUpdateCommitWindowOpen(blockchain, agreementId, epoch, latestStateIndex) {
return this.callImplementationFunction(blockchain, 'isUpdateCommitWindowOpen', [
agreementId,
epoch,
stateIndex,
latestStateIndex,
]);
}

async getTopCommitSubmissions(blockchain, agreementId, epoch, stateIndex) {
async getTopCommitSubmissions(blockchain, agreementId, epoch, latestStateIndex) {
return this.callImplementationFunction(blockchain, 'getTopCommitSubmissions', [
agreementId,
epoch,
stateIndex,
latestStateIndex,
]);
}

Expand Down Expand Up @@ -225,6 +226,7 @@ class BlockchainModuleManager extends BaseModuleManager {
keyword,
hashFunctionId,
epoch,
latestStateIndex,
callback,
) {
return this.callImplementationFunction(blockchain, 'submitCommit', [
Expand All @@ -233,6 +235,7 @@ class BlockchainModuleManager extends BaseModuleManager {
keyword,
hashFunctionId,
epoch,
latestStateIndex,
callback,
]);
}
Expand All @@ -256,18 +259,20 @@ class BlockchainModuleManager extends BaseModuleManager {
]);
}

async isProofWindowOpen(blockchain, agreementId, epoch) {
async isProofWindowOpen(blockchain, agreementId, epoch, latestStateIndex) {
return this.callImplementationFunction(blockchain, 'isProofWindowOpen', [
agreementId,
epoch,
latestStateIndex,
]);
}

async getChallenge(blockchain, assetContractAddress, tokenId, epoch) {
async getChallenge(blockchain, assetContractAddress, tokenId, epoch, latestStateIndex) {
return this.callImplementationFunction(blockchain, 'getChallenge', [
assetContractAddress,
tokenId,
epoch,
latestStateIndex,
]);
}

Expand All @@ -280,6 +285,7 @@ class BlockchainModuleManager extends BaseModuleManager {
epoch,
proof,
chunkHash,
latestStateIndex,
callback,
) {
return this.callImplementationFunction(blockchain, 'sendProof', [
Expand All @@ -290,6 +296,7 @@ class BlockchainModuleManager extends BaseModuleManager {
epoch,
proof,
chunkHash,
latestStateIndex,
callback,
]);
}
Expand Down
71 changes: 52 additions & 19 deletions src/modules/blockchain/implementation/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const ProfileABI = require('dkg-evm-module/abi/Profile.json');
const ProfileStorageABI = require('dkg-evm-module/abi/ProfileStorage.json');
const ScoringProxyABI = require('dkg-evm-module/abi/ScoringProxy.json');
const ServiceAgreementV1ABI = require('dkg-evm-module/abi/ServiceAgreementV1.json');
const CommitManagerV1ABI = require('dkg-evm-module/abi/CommitManagerV1.json');
const CommitManagerV1U1ABI = require('dkg-evm-module/abi/CommitManagerV1U1.json');
const ProofManagerV1ABI = require('dkg-evm-module/abi/ProofManagerV1.json');
const ProofManagerV1U1ABI = require('dkg-evm-module/abi/ProofManagerV1U1.json');
const ShardingTableABI = require('dkg-evm-module/abi/ShardingTable.json');
const ShardingTableStorageABI = require('dkg-evm-module/abi/ShardingTableStorage.json');
Expand Down Expand Up @@ -123,7 +125,9 @@ class Web3Service {
this.initializeContract('Profile', ProfileABI),
this.initializeContract('ProfileStorage', ProfileStorageABI),
this.initializeContract('ServiceAgreementV1', ServiceAgreementV1ABI),
this.initializeContract('CommitManagerV1', CommitManagerV1ABI),
this.initializeContract('CommitManagerV1U1', CommitManagerV1U1ABI),
this.initializeContract('ProofManagerV1', ProofManagerV1ABI),
this.initializeContract('ProofManagerV1U1', ProofManagerV1U1ABI),
this.initializeContract(
'ServiceAgreementStorageProxy',
Expand Down Expand Up @@ -540,11 +544,18 @@ class Web3Service {
return Number(assertionChunksNumber);
}

async isCommitWindowOpen(agreementId, epoch) {
return this.callContractFunction(this.CommitManagerV1U1Contract, 'isCommitWindowOpen', [
agreementId,
epoch,
]);
selectCommitManagerContract(latestStateIndex) {
return latestStateIndex === 0
? this.CommitManagerV1Contract
: this.CommitManagerV1U1Contract;
}

async isCommitWindowOpen(agreementId, epoch, latestStateIndex) {
return this.callContractFunction(
this.selectCommitManagerContract(latestStateIndex),
'isCommitWindowOpen',
[agreementId, epoch],
);
}

async isUpdateCommitWindowOpen(agreementId, epoch, stateIndex) {
Expand All @@ -555,11 +566,14 @@ class Web3Service {
);
}

async getTopCommitSubmissions(agreementId, epoch, stateIndex) {
async getTopCommitSubmissions(agreementId, epoch, latestStateIndex) {
const args =
latestStateIndex === 0 ? [agreementId, epoch] : [agreementId, epoch, latestStateIndex];

const commits = await this.callContractFunction(
this.CommitManagerV1U1Contract,
this.selectCommitManagerContract(latestStateIndex),
'getTopCommitSubmissions',
[agreementId, epoch, stateIndex],
args,
);

return commits
Expand Down Expand Up @@ -596,9 +610,17 @@ class Web3Service {
return finalizationCommitsNumber;
}

async submitCommit(assetContractAddress, tokenId, keyword, hashFunctionId, epoch, callback) {
async submitCommit(
assetContractAddress,
tokenId,
keyword,
hashFunctionId,
epoch,
latestStateIndex,
callback,
) {
return this.queueTransaction(
this.CommitManagerV1U1Contract,
this.selectCommitManagerContract(latestStateIndex),
'submitCommit',
[[assetContractAddress, tokenId, keyword, hashFunctionId, epoch]],
callback,
Expand All @@ -621,18 +643,28 @@ class Web3Service {
);
}

async isProofWindowOpen(agreementId, epoch) {
return this.callContractFunction(this.ProofManagerV1U1Contract, 'isProofWindowOpen', [
agreementId,
epoch,
]);
selectProofManagerContract(latestStateIndex) {
return latestStateIndex === 0 ? this.ProofManagerV1Contract : this.ProofManagerV1U1Contract;
}

async getChallenge(assetContractAddress, tokenId, epoch) {
async isProofWindowOpen(agreementId, epoch, latestStateIndex) {
return this.callContractFunction(
this.selectProofManagerContract(latestStateIndex),
'isProofWindowOpen',
[agreementId, epoch],
);
}

async getChallenge(assetContractAddress, tokenId, epoch, latestStateIndex) {
const args =
latestStateIndex === 0
? [this.getPublicKey(), assetContractAddress, tokenId, epoch]
: [assetContractAddress, tokenId, epoch];

const result = await this.callContractFunction(
this.ProofManagerV1U1Contract,
this.selectProofManagerContract(latestStateIndex),
'getChallenge',
[assetContractAddress, tokenId, epoch],
args,
);

return { assertionId: result['0'], challenge: result['1'] };
Expand All @@ -646,10 +678,11 @@ class Web3Service {
epoch,
proof,
chunkHash,
latestStateIndex,
callback,
) {
return this.queueTransaction(
this.ProofManagerV1U1Contract,
this.selectProofManagerContract(latestStateIndex),
'sendProof',
[[assetContractAddress, tokenId, keyword, hashFunctionId, epoch, proof, chunkHash]],
callback,
Expand Down

0 comments on commit bd4ab99

Please sign in to comment.