dkg-engine icon indicating copy to clipboard operation
dkg-engine copied to clipboard

GET for v6 asset fails

Open botnumberseven opened this issue 9 months ago • 14 comments

Issue description

I'm running GET command with dkg.py for two assets: did:dkg:otp:2043/0x5cAC41237127F94c2D21dAe0b14bFeFa99880630/2675738 - v6 asset did:dkg:otp:2043/0x8f678eB0E57ee8A109B295710E23076fA3a443fe/2675738 - v8 asset same token_id, but different asset storage contracts

With manual fix for https://github.com/OriginTrail/ot-node/issues/3797 I can get v8 asset. But I can't get v6 asset.

It looks like that v6 asset GET fails UAL validation. Here https://github.com/OriginTrail/ot-node/blob/v8/develop/src/commands/protocols/get/sender/get-command.js#L63 isValid is False, and that ends the GET command execution.

I added errorMessage in the logs and it shows: [2025-04-07 18:03:09] DEBUG: {Operation ID: c850063c-07cf-416c-aa91-7ac37ed3d360} [getCommand] (Command ID: fdde6bb0-0ed5-4502-ace2-26a35430e3fa) did:dkg:otp:2043/0x5cAC41237127F94c2D21dAe0b14bFeFa99880630/2675738 - isValid false - Get for operation id: c850063c-07cf-416c-aa91-7ac37ed3d360, UAL: did:dkg:otp:2043/0x5cAC41237127F94c2D21dAe0b14bFeFa99880630/2675738: there is no asset with this UAL.

Steps to reproduce the problem

Run GET for did:dkg:otp:2043/0x5cAC41237127F94c2D21dAe0b14bFeFa99880630/2675738 using dkg.py

Disclaimer

Please be aware that the issue reported on a public repository allows everyone to see your node logs, node details, and contact details. If you have any sensitive information, feel free to share it by sending an email to [email protected].

botnumberseven avatar Apr 07 '25 19:04 botnumberseven

Hey issue you found is true but it only affects testnet, as this code is not on mainnet yet.

I can find v8 asset using dkg.js and dkg.py, I can't find v6 we will investigate further

Mihajlo-Pavlovic avatar Apr 08 '25 14:04 Mihajlo-Pavlovic

Yeah, I figured it that out as well ^_^ - https://github.com/OriginTrail/ot-node/issues/3803

botnumberseven avatar Apr 08 '25 15:04 botnumberseven

@Mihajlo-Pavlovic Also could you please check if "include_metadata": True in dkg.py GET works as expected? I can GET v8 asset data from the DKG (not from local node), but metadata is always None even with explicit "include_metadata": True.

My node is on v6/release/mainnet, as I understand it's v8 mainnet version.

looks like this might have something to do with this - https://github.com/OriginTrail/ot-node/blob/5e03a0d6f8c7b8156a0bbf02f2dd2f0b28341010/src/service/triple-store-service.js#L485-L490 My asset is v8 asset, but it still uses getKnowledgeAssetMetadata (instead of getKnowledgeCollectionMetadata) because knowledgeAssetId is not None, but {"startTokenId":1,"endTokenId":1,"burned":[]}

But if I make it use getKnowledgeCollectionMetadata it does not like the UAL. If remove assetId object from the UAL, then node can find metadata in Triple Store correctly, although dkg.py still get None as metadata.

botnumberseven avatar Apr 08 '25 16:04 botnumberseven

@zsculac @ilijaMar Can you guys check this, I thing you implement this for dkg.py?

Mihajlo-Pavlovic avatar Apr 09 '25 08:04 Mihajlo-Pavlovic

Appreciate your support here folks, as from where I sit it looks like:

  1. fetching v6 asset does not work with dkg.py at all
  2. fetching v8 asset works, however getting metadata does not work. I'm not sure if it's dkg.py issue or node itself.

botnumberseven avatar Apr 09 '25 12:04 botnumberseven

Yeah, does not seem the issue with metadata fetching has much to do with dkg.py. This is the output from dkg.js for fetching an asset with metadata, same as for dkg.py. Looks like the query to triple store the node constructs is incorrect.

Fetching data for Paranet UAL: did:dkg:otp:2043/0x8f678eB0E57ee8A109B295710E23076fA3a443fe/2675738 Paranet Data: { "operation": { "get": { "operationId": "8d2b870b-5c42-41d8-8f17-fe17e98a4d49", "status": "FAILED", "errorMessage": "Parse error on line 2:\n... CONSTRUCT { <did:dkg:otp:2043/0x\n-----------------------^\nExpecting 'IRIREF', 'PNAME_NS', '}', '(', 'INTEGER', 'VAR', 'NIL', '[', 'DECIMAL', 'DOUBLE', 'BOOLEAN', 'INTEGER_POSITIVE', 'DECIMAL_POSITIVE', 'DOUBLE_POSITIVE', 'INTEGER_NEGATIVE', 'DECIMAL_NEGATIVE', 'DOUBLE_NEGATIVE', 'STRING_LITERAL1', 'STRING_LITERAL2', 'STRING_LITERAL_LONG1', 'STRING_LITERAL_LONG2', 'PNAME_LN', 'BLANK_NODE_LABEL', 'ANON', '<<', got '<'", "errorType": "GetLocalError" } } }

Could you check this please? https://github.com/OriginTrail/ot-node/blob/5e03a0d6f8c7b8156a0bbf02f2dd2f0b28341010/src/service/triple-store-service.js#L473

This function receives a range of KA IDs as knowledgeAssetId, like this {"startTokenId":1,"endTokenId":3,"burned":[]}. But then it just adds it as an object to UAL, then it goes to getKnowledgeAssetMetadata (not to getKnowledgeCollectionMetadata ) and try to run a query like this:

CONSTRUCT { <did:dkg:otp:2043/0x8f678eb0e57ee8a109b295710e23076fa3a443fe/2675738/[object Object]> ?p ?o . } WHERE { GRAPH metadata:graph { <did:dkg:otp:2043/0x8f678eb0e57ee8a109b295710e23076fa3a443fe/2675738/[object Object]> ?p ?o . } }

botnumberseven avatar Apr 11 '25 14:04 botnumberseven

@Mihajlo-Pavlovic What ot-node version do you expect the fixes to intercept?

In my understanding there are two independent issues - inability to fetch metadata with any v8 asset AND inability to fetch v6 asset (not sure about metadata here)

botnumberseven avatar Apr 28 '25 14:04 botnumberseven

Hey @botnumberseven metadata is going to be fixed with next mainnet release

Mihajlo-Pavlovic avatar Apr 29 '25 09:04 Mihajlo-Pavlovic

@Mihajlo-Pavlovic As I can see something changed in 8.0.11, but metadata still does not work.

I simplified the setup as much as possible to test it. I have 8.0.11 node with empty blazegraph. I then publish an asset thru this node (neuro mainnet token_id - 3040781). Now my node blazegraph has several triples (asset + metadata) - see blazegraph_content.txt

Now using dkg.py I issue GET request to the same node (so it should response with all local data). And the result I get is this, metadata is None. {'assertion': '<https://audi.a5/> <http://schema.org/name> "Audi A5" .\n<https://audi.a5/> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Car> .', 'operation': {'get': {'operationId': '74efd7bd-4642-4427-a525-53b8d707c327', 'status': 'COMPLETED'}}, 'metadata': None}

Here is a relevant part of the log - node_log.txt As you can see it found an assertion and metadata locally, but for some reason dkg.py did not get the metadata (or node did not share it with dkg.py?).

botnumberseven avatar Apr 29 '25 17:04 botnumberseven

@Mihajlo-Pavlovic btw, any comments on GET for v6 assets (can't GET a single v6 asset with dkg.py)?

Am I the only one who observe the error and the issue is at my side? Or maybe it's a known issue?

UPDATE: The error I see when I try to GET v6 asset is there is no asset with this UAL (UAL example - did:dkg:otp:2043/0x5cac41237127f94c2d21dae0b14bfefa99880630/100033). So UAL fails validation (validateUal).

That means getLatestMerkleRootPublisher fails. And it fails because v6 asset storage contract (in case of neuro mainnet 0x5cAC41237127F94c2D21dAe0b14bFeFa99880630) is not in the list of storage contracts.

this https://github.com/OriginTrail/ot-node/blob/v6/release/mainnet/src/modules/blockchain/implementation/web3-service.js#L910 checks if provided contract address is in the list of known asset storage contracts

But if I call getAllAssetStorages function in the Hub contract the only value it returns is v8 storage contract hub_contract.functions.getAllAssetStorages().call() Out[87]: [('KnowledgeCollectionStorage', '0x8f678eB0E57ee8A109B295710E23076fA3a443fe')]

But why does it use validateUal, since it's a v6 asset. Shouldn't it use validateUalV6?

botnumberseven avatar May 03 '25 21:05 botnumberseven

Hey @botnumberseven

Thank you for the very thorough issue reports!

The team has checked the V6 asset get issue, and we are actively working on it. It will be patched very soon.

usebeforefree avatar May 15 '25 07:05 usebeforefree

Hey @botnumberseven,

Both of these issues have been solved with the new releases of dkg.py

Take a look at the latest one here https://github.com/OriginTrail/dkg.py/releases

Thank you for reporting them, and providing input data!

usebeforefree avatar Jul 10 '25 08:07 usebeforefree

@marko03kostic Thanks, just to double check here, it's possible to GET v6 asset as well now, is it correct?

I'll check it a bit later. I'm asking as I thought the issue was with how node handles v6 GET request, not with how dkg.py makes the request. Anyway i'll check it out.

botnumberseven avatar Jul 10 '25 11:07 botnumberseven

Hey @botnumberseven,

I've mixed up another issue with this one. To be precise, the dkg.py metadata issue has been fixed. I don't have any updates on the V6 assets atm. Back to you soon, and sorry for the misunderstanding!

usebeforefree avatar Jul 15 '25 09:07 usebeforefree