Skip to content

Commit

Permalink
Rename isOldContract into isV6Contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Zvonimir authored and Zvonimir committed Dec 31, 2024
1 parent 7c2db0e commit df6fd26
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {
ual,
includeMetadata,
isOperationV0,
isOldContract,
isV6Contract,
} = commandData;

let { assertionId, knowledgeAssetId } = commandData;
Expand Down Expand Up @@ -229,7 +229,7 @@ class HandleGetRequestCommand extends HandleProtocolMessageCommand {

const responseData = {
assertion:
(isOperationV0 || notMigrated) && isOldContract
(isOperationV0 || notMigrated) && isV6Contract
? [...(assertion.public ?? []), ...(assertion.private ?? [])]
: assertion,
...(includeMetadata && metadata && { metadata }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GetValidateAssetCommand extends ValidateAssetCommand {
knowledgeCollectionId,
ual,
isOperationV0,
isOldContract,
isV6Contract,
} = command.data;
await this.operationIdService.updateOperationIdStatus(
operationId,
Expand All @@ -56,7 +56,7 @@ class GetValidateAssetCommand extends ValidateAssetCommand {
blockchain,
);
// TODO: Update to validate knowledge asset index
if (!isOperationV0 && !isOldContract) {
if (!isOperationV0 && !isV6Contract) {
const isValidUal = await this.validationService.validateUal(
blockchain,
contract,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/protocols/get/sender/local-get-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LocalGetCommand extends Command {
contentType,
assertionId,
isOperationV0,
isOldContract,
isV6Contract,
} = command.data;
let { knowledgeAssetId } = command.data;
await this.operationIdService.updateOperationIdStatus(
Expand Down Expand Up @@ -219,7 +219,7 @@ class LocalGetCommand extends Command {

const responseData = {
assertion:
(isOperationV0 || notMigrated) && isOldContract
(isOperationV0 || notMigrated) && isV6Contract
? [...(assertion?.public ?? []), ...(assertion?.private ?? [])]
: assertion,
...(includeMetadata && metadata && { metadata }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GetRequestCommand extends ProtocolRequestCommand {
paranetId,
isOperationV0,
assertionId,
isOldContract,
isV6Contract,
} = command.data;

return {
Expand All @@ -65,7 +65,7 @@ class GetRequestCommand extends ProtocolRequestCommand {
paranetId,
isOperationV0,
assertionId,
isOldContract,
isV6Contract,
};
}

Expand All @@ -76,7 +76,7 @@ class GetRequestCommand extends ProtocolRequestCommand {
knowledgeCollectionId,
knowledgeAssetId,
isOperationV0,
isOldContract,
isV6Contract,
} = command.data;

if (responseData?.assertion?.public) {
Expand All @@ -103,7 +103,7 @@ class GetRequestCommand extends ProtocolRequestCommand {
...kcTools.groupNquadsBySubject(privateHashTriples, true),
);

if (!isOldContract) {
if (!isV6Contract) {
try {
await this.validationService.validateDatasetOnBlockchain(
publicKnowledgeAssetsTriplesGrouped.map((t) => t.sort()).flat(),
Expand Down
2 changes: 1 addition & 1 deletion src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ export const TRIPLES_VISIBILITY = {
ALL: 'all',
};

export const OLD_CONTENT_STORAGE_MAP = {
export const V6_CONTENT_STORAGE_MAP = {
BASE_MAINNET: '0x3bdfA81079B2bA53a25a6641608E5E1E6c464597',
BASE_TESTNET: '0x9e3071Dc0730CB6dd0ce42969396D716Ea33E7e1',
BASE_DEVNET: '0xBe08A25dcF2B68af88501611e5456571f50327B4',
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/http-api/v0/get-http-api-controller-v0.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
OPERATION_STATUS,
ERROR_TYPE,
TRIPLES_VISIBILITY,
OLD_CONTENT_STORAGE_MAP,
V6_CONTENT_STORAGE_MAP,
} from '../../../constants/constants.js';
import BaseController from '../base-http-api-controller.js';

Expand Down Expand Up @@ -65,13 +65,13 @@ class GetController extends BaseController {
// Get assertionId - datasetRoot
//

const isOldContract = Object.values(OLD_CONTENT_STORAGE_MAP).some((ca) =>
const isV6Contract = Object.values(V6_CONTENT_STORAGE_MAP).some((ca) =>
ca.toLowerCase().includes(contract.toLowerCase()),
);

const commandSequence = [];

if (!tripleStoreMigrationAlreadyExecuted && isOldContract) {
if (!tripleStoreMigrationAlreadyExecuted && isV6Contract) {
commandSequence.push('getAssertionMerkleRootCommand');
}

Expand All @@ -90,7 +90,7 @@ class GetController extends BaseController {
knowledgeAssetId,
operationId,
paranetUAL,
isOldContract,
isV6Contract,
contentType: contentType ?? TRIPLES_VISIBILITY.ALL,
isOperationV0: true,
},
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/http-api/v1/get-http-api-controller-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
OPERATION_STATUS,
ERROR_TYPE,
TRIPLES_VISIBILITY,
OLD_CONTENT_STORAGE_MAP,
V6_CONTENT_STORAGE_MAP,
} from '../../../constants/constants.js';
import BaseController from '../base-http-api-controller.js';

Expand Down Expand Up @@ -66,14 +66,14 @@ class GetController extends BaseController {
// Get assertionId - datasetRoot
//

const isOldContract = Object.values(OLD_CONTENT_STORAGE_MAP).some((ca) =>
const isV6Contract = Object.values(V6_CONTENT_STORAGE_MAP).some((ca) =>
ca.toLowerCase().includes(contract.toLowerCase()),
);

const commandSequence = [];
commandSequence.push('getValidateAssetCommand');

if (!tripleStoreMigrationAlreadyExecuted && isOldContract) {
if (!tripleStoreMigrationAlreadyExecuted && isV6Contract) {
commandSequence.push('getAssertionMerkleRootCommand');
}

Expand All @@ -92,7 +92,7 @@ class GetController extends BaseController {
knowledgeAssetId,
operationId,
paranetUAL,
isOldContract,
isV6Contract,
contentType: contentType ?? TRIPLES_VISIBILITY.ALL,
},
transactional: false,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/rpc/get-rpc-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GetController extends BaseController {
paranetId: message.data.paranetId,
isOperationV0: message.data.isOperationV0,
assertionId: message.data.assertionId,
isOldContract: message.data.isOldContract,
isV6Contract: message.data.isV6Contract,
},
transactional: false,
});
Expand Down

0 comments on commit df6fd26

Please sign in to comment.