ot-node icon indicating copy to clipboard operation
ot-node copied to clipboard

'rootHash' is not a property of object returned from a resolve assertion request

Open rmul247 opened this issue 3 years ago • 2 comments

Issue description

The object returned from 'rpc-controller.js', upon resolving an assertion does not have any property that contains a key/value pair of the root hash. Because of this, when trying to perform a merkle proof to verify the data an error is thrown: " TypeError: Cannot read property 'rootHash' of undefined" (I was using the [email protected] to contact the node)

Expected behavior

The result of the resolve request should have a property for the rootHash

Actual behavior

No rootHash property is part of the resolve object An error occurs when validating data as the proof function requires the rootHash to work, and it looks to the resolved object to get this rootHash. But it isn't there.

Steps to reproduce the problem

  1. Create a new instance of the dkg-client, call it dkg.

  2. Try to resolve an assertion using dkg-client.resolve(options), with options:

options = { ids: [8bb8240c8161acccb02f502c80e6cfa83f088aebb1e8035536464f3bbd557c6a] }; and run code:

await dkg.resolve(options).then((result) => { console.log("Resolved assertion: ", assertionID); console.log(JSON.stringify(result)); }).catch((error) => { console.log("Error resolving assertion. Error: ${error}"); });

there should be no rootHash key in the resulting object.

  1. Try to prove integrity of data using dkg-client.validate(options),

` options = { nquads: [ 'did:dkg:ac56bb3f731c59040101bd54494eae93febd4f94967fea4dde3f78c5ca0582c2 http://schema.org/hasDataHash "25635fc0130569a8ee53d1b7579fa96bf2b75c26420c07a44e0f261545176389" .', ], };

      await dkg.validate(options).then((result) => {
            console.log(JSON.stringify(result));
      }).catch((error) => {
            console.log("Error proving validity of data. Error: ${error}");
  }); 

`

  1. An error (shown below) will occur.

Specifications

  • Node version: OriginTrail Node v6.0.0-beta.1.33-hotfix.2
  • Platform: Ubuntu 20.04 (LTS) x64
  • Node wallet: 0x51C328077815c405324fc3328715303382Ce3f6d
  • Node libp2p identity: QmXqoxNYRxxVPAcEBV4PvJ7U2ZSEgxZQ5ukLy8YzESXjMS

Contact details

Error logs

Proof error: TypeError: Cannot read property 'rootHash' of undefined at DkgClient._fetchRootHash (/root/basicTester/node_modules/dkg-client/client/abstract-client.js:360:37) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async DkgClient._performValidation (/root/basicTester/node_modules/dkg-client/client/abstract-client.js:333:28) at async /root/basicTester/node_modules/dkg-client/client/abstract-client.js:304:36

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].

rmul247 avatar Apr 04 '22 07:04 rmul247

_validateProof(obj, rootHash) {
    // const tree = new MerkleTools();
    // const leaf = obj.tripleHash;
    // const verified = tree.validateProof(obj.proof, leaf, rootHash);
    // return verified;
}

they have commented out the function in dkg.js

ulysseseng avatar Apr 08 '22 14:04 ulysseseng

We need to review the validation function. I'll leave leave a comment here once it's fixed.

zeroxbt avatar Apr 21 '22 14:04 zeroxbt

This issue is being closed as inactive due to the date of the last activity on it. If you believe this is still a problem, please create a new issue and confirm that it is reproducible in the current ot-node release version. We are working towards closing open issues that meet specific criteria and ask you to create a new one for those that that are truly bugs in current release. We'll be monitoring those issues so that they are properly managed.

Thank you, OriginTrail Team

djordjekovac avatar Sep 02 '22 09:09 djordjekovac