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

remove validation for v6 client #3557

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 0 additions & 23 deletions src/commands/common/validate-asset-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ERROR_TYPE,
OPERATION_ID_STATUS,
LOCAL_STORE_TYPES,
ZERO_BYTES32,
PARANET_ACCESS_POLICY,
} from '../../constants/constants.js';

Expand Down Expand Up @@ -39,35 +38,13 @@ class ValidateAssetCommand extends Command {
OPERATION_ID_STATUS.VALIDATE_ASSET_START,
);

const blockchainAssertionId =
await this.blockchainModuleManager.getKnowledgeCollectionLatestMerkleRoot(
blockchain,
contract,
tokenId,
);
if (!blockchainAssertionId || blockchainAssertionId === ZERO_BYTES32) {
return Command.retry();
}
// TODO: Validate number of triplets and other stuff we did before so it matches like we did it in v6
const cachedData = await this.operationIdService.getCachedOperationIdData(operationId);
const ual = this.ualService.deriveUAL(blockchain, contract, tokenId);

// backwards compatibility
const cachedAssertion = cachedData.datasetRoot || cachedData.public.assertionId;
const cachedDataset = cachedData.dataset || cachedData.public.assertion;
this.logger.info(
`Validating asset's public assertion with id: ${cachedAssertion} ual: ${ual}`,
);
if (blockchainAssertionId !== cachedAssertion) {
await this.handleError(
operationId,
blockchain,
`Invalid assertion id for asset ${ual}. Received value from blockchain: ${blockchainAssertionId}, received value from request: ${cachedData.public.assertionId}`,
this.errorType,
true,
);
return Command.empty();
}

// V0 backwards compatibility
if (cachedData.private?.assertionId && cachedData.private?.assertion) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ class GetValidateAssetCommand extends ValidateAssetCommand {
);
// TODO: Update to validate knowledge asset index
const isValidUal = isOperationV0
? await this.validationService.validateUalV6(
blockchain,
contract,
knowledgeCollectionId,
)
? true
: await this.validationService.validateUal(blockchain, contract, knowledgeCollectionId);
this.operationIdService.emitChangeEvent(
OPERATION_ID_STATUS.GET.GET_VALIDATE_UAL_END,
Expand Down
Loading