PharmaLedger-IMI / blockchain-hlf-workspace

Workspace files to install HyperLedger fabric and test hf-adapter
MIT License
0 stars 0 forks source link

Build of fgt-workspace with hf-adapter fails - Trying to insert into existing record #2

Closed joaoluis-pdm closed 2 years ago

joaoluis-pdm commented 2 years ago

Building the https://github.com/PharmaLedger-IMI/fgt-workspace (+/- at v0.9.5) 16604637e0d28b61e18c6af76564eaf6c5b513fb using psk-release e7c923dbaf6cbe75041bcfb1dd8600b8ddb0508d hf-adapter cdf60d1bf331b2154171ac4be5cedd900621b9dc (2022-03-15)

Annex buildallhf.log - build using hf-adapter buildallhf.log

Annex buildallnochain.log - build using simulated FS anchoring buildallnochain.log

The error in buildallhf.log happens in line 331.

...
> fgt-mah-ssapp@0.2.1 build
> node ./node_modules/octopus/scripts/buildDossier ./bin/build.file --domain=traceability

Logger not available, using console
Redefining require for node
The function "getWalletDB is obsolete. Use getSimpleWalletDB instead
The function "getWalletDB is obsolete. Use getSimpleWalletDB instead
Finishing initialisation
>>> No observers found for event type warn
>>> Loading a shared database
Finishing initialisation
>>> No observers found for event type warn
>>> Loading a shared database
DSU not available. Creating a new DSU for o7oyuxBsug4VozamZzwhz8SUPhQfUAukGL9GRiFJoBNw98umsGmg1VNXWHqA1y6YYYbtWoDvg8TKMkUAUgxtbp6Vf1mGDBtwHbC85jg2zEPfu9BC3t6nwkzCUjDf75xWMeywVZi2kWLBg6KF4aE4ETn22jjvhqxP14QRm78mFP9ZipSjux7oXGRD1whVKLghtNuqvimKXkVgi7pFUpKHJybRh
Build process of <fgt-mah-ssapp> failed.
Error: Trying to insert into existing record
    at ErrorWrapper (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:22686:22)
    at createOpenDSUErrorWrapper (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:22713:12)
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17531:33
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17602:13
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:18854:13
    at newFn (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:40192:20)
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:696:13
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6890:17
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6299:28
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2541:17
    at EncryptionTransformation.undo (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:7309:9)
    at Brick.getRawData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2535:30)
    at extractData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:378:27)
    at Service.brickDataExtractorCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:386:17)
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6290:22
    at checkBrickDataIntegrity (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6282:17)
    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6285:13
    at runnerCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:15912:17)
    at executeForSingleEntry (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:27578:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  originalMessage: 'Trying to insert into existing record',
  previousError: Error: Trying to insert into existing record
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17531:103
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17602:13
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:18854:13
      at newFn (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:40192:20)
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:696:13
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6890:17
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6299:28
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2541:17
      at EncryptionTransformation.undo (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:7309:9)
      at Brick.getRawData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2535:30)
      at extractData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:378:27)
      at Service.brickDataExtractorCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:386:17)
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6290:22
      at checkBrickDataIntegrity (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6282:17)
      at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6285:13
      at runnerCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:15912:17)
      at executeForSingleEntry (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:27578:13)
      at processTicksAndRejections (node:internal/process/task_queues:96:5),
  debug_message: 'Failed to insert over an existing record',
  debug_stack: 'Error: Trying to insert into existing record\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17531:103\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:17602:13\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:18854:13\n' +
    '    at newFn (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:40192:20)\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:696:13\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6890:17\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6299:28\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2541:17\n' +
    '    at EncryptionTransformation.undo (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:7309:9)\n' +
    '    at Brick.getRawData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:2535:30)\n' +
    '    at extractData (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:378:27)\n' +
    '    at Service.brickDataExtractorCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:386:17)\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6290:22\n' +
    '    at checkBrickDataIntegrity (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6282:17)\n' +
    '    at /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:6285:13\n' +
    '    at runnerCallback (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:15912:17)\n' +
    '    at executeForSingleEntry (/export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js:27578:13)\n' +
    '    at processTicksAndRejections (node:internal/process/task_queues:96:5)'
}

The comparative correct build buildallnochain.log shows instead:

> fgt-mah-ssapp@0.2.1 build
> node ./node_modules/octopus/scripts/buildDossier ./bin/build.file --domain=traceability

Logger not available, using console
Redefining require for node
creating a new dossier...
The function "getWalletDB is obsolete. Use getSimpleWalletDB instead
The function "getWalletDB is obsolete. Use getSimpleWalletDB instead
Finishing initialisation
>>> No observers found for event type warn
>>> Loading a shared database
Finishing initialisation
>>> No observers found for event type warn
>>> Loading a shared database
Deleting /
Copying file bin/init.file to init.file
Adding Folder /code
Mounting sread 2bcRL99QEndt29PwFFbzRf9cpRgiduyQjwDW4AfVFLbzxvCRxFCoaxctAdnSQaW9KjNaAMYnLYZQN5oTrNhgkso8AxYhZDNZH3hfipJruMG9HKKonUuLHCa7aY8cQQ1a553UuLevZ727Vjr7pyE7VQg36in7SidQGFuPSZBdD8dx4M8Mk4kHPP517EkJJJG1A1Pmsw71AiGYuBoWiw9 to /webcardinal
Mounting sread 2bcRL99QEndt29PwFFbzRf9cpRkb1XrsLLyRmNS1cRZArAQrYNAHvnU6fDnyATEd1C4pC9efk6k8k64iDjvEc5rMKsHjhrowSfpuwaqM2GDksan86pcaSMyR5E9HapXdfD8AkJceQVxykLPLjis4FyKGTeeMtHbaSjeiwJRiq4Sc1y7CS4GDVZoQGWfzB5waJYxhM5Zui1NWttauYeb to /themes/blue-fluorite-theme
Mounting sread 2bcRL99QEndt29PwFFbzRf9cpT2zQGHzZrP6FbqAJbrEn8bq9f1LLNAC3MXeDA9FM5BGQU5cBodUk3tLYtiJGJo55Ae8bDJHwATxhjPqPizK92chAWn9aguZVorqCVE4nqwkoxGY2eDqrt82GRhTUepxRXoWnueNvngY5BkrivKNEv4yryDmiPCNSnjCFWQbCuhCtxGZNXcfqs1ZJoZ to /themes/clear-sky-theme
Mounting sread 2bcRL99QEndt29PwFFbzRf9cpSjbhyJL4qRC4CXbiMY6gxYxxbNmhxQoXbEivwCZ1ypnUgQAfRfPzuGAaJn9aq9tQxEZbPy71G4Euqg9EHfCcCwWNmsWkhVULhhjpTRmkJcahMsAyPCS5xZnYSdyCYtJsfnWeAPtiqaZRZofaqLPihFK1aWxCjqtNxXEm8gUD3qRQeKwfupqDYz8aLw to /themes/pdm-theme
Build process of <fgt-mah-ssapp> finished. Dossier's KeySSI: o7oyuxBsug4VozamZzwhz8SUPhQfUAukGL9GRiFJoBNw98umsGmg1VNXWHqA1y6YYYbtWoDvg8TKMkUAUgxtbp6Vf1mGDBtwHbC85jg2zEPfu9BC3t6nwkzCUjDf75xWMeywVZi2kWLBg6KF4aE4ETn22jjvhqxP14QRm78mFP9ZipSjux7oXGRD1whVKLghtNuqvimKXkVgi7pFUpKHJybRh
Start copying ./fgt-mah-ssapp/seed to folder ./apihub-root/fgt-mah-wallet/wallet-patch/seed

Not clear if the message before "DSU not available. Creating a new DSU for ..." belongs to /export/home/jpsl/develop/PharmaLedger/fgt-workspace/privatesky/psknode/bundles/openDSU.js getSharedEnclave() or /export/home/jpsl/develop/PharmaLedger/fgt-workspace/pdm-dsu-toolkit/services/dt/DossierBuilder.js buildDossier() ...

Confirmed that the "DSU not available. Creating a new DSU for ..." message is the one logged on fgt-workspace/privatesky/psknode/bundles/openDSU.js DossierBuilder.buildDossier() on callback after a _getSharedEnclave()

joaoluis-pdm commented 2 years ago

The failing enclave seems an Enclave_Mixin / WalletDBEnclave and fails at Enclave_Mixin.storeKeySSI() in the insertRecord line. target is a WalletDBEnclave, and target.storageDB is undefined.

joaoluis-pdm commented 2 years ago

Putting a lot of console.log into privatesky/psknode/bundles/openDSU.js to debug environment around shared enclave creation: openDSU.zip

The build no longer gives an error. buildall-hf4.log

Test with a single MAH, creating one product and one batch worked.

joaoluis-pdm commented 2 years ago

Diffs in the privatesky/psknode/bundles/openDSU.js for the version that worked... openDSU.diff.txt

joaoluis-pdm commented 2 years ago

This problem could not be reproduced anymore... Even with the original openmDSU.js the error no longer happens.