PharmaLedger-IMI / blockchain-node-workspace

Allows to quickly raise a blockchain (goQuorum) along easily connectod to an OpenDSU Api Hub for anchoring
MIT License
1 stars 0 forks source link

Restore operationality of this workspace, and test with FGT and CTR #1

Closed joaoluis-pdm closed 2 years ago

joaoluis-pdm commented 2 years ago

It seems to be working +/-

When building the ethAdapter docker seems not to be using a frozen version of ePi as intended.

I will create a tag v0.2.0 for this release. (Using the commit hash in FGT).

joaoluis-pdm commented 2 years ago

ethAdapter is now failing with

Server started. Listening on  3000
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.

Original quorum-docker is working. Find diffs:

jpsl@PDM-00781:~/develop/PharmaLedger/blockchain-node-workspace/quorum-docker$ diff -r --exclude=node_modules ../../quorum-docker . | less
joaoluis-pdm commented 2 years ago

Doubts about persistence of blockchain-node-worspace remains. Does stop/starting the ethAdapter looses proper smart contract address ?

joaoluis-pdm commented 2 years ago

image

joaoluis-pdm commented 2 years ago

Every time a sequence

npm run stop-blockchain
npm run start-blockchain

the smart contract address (or orgAccount) appears to have changed, and that is wrong.

joaoluis-pdm commented 2 years ago

It seems that the problem reported above is not the change of smartcontract, is the deleting of data dir in the quorum nodes. https://github.com/PharmaLedger-IMI/quorum-docker/blob/e8b03aa15523263de739985ba5981df50c179b23/quorum/docker-compose.yml shows:

...
      DDIR=/qdata/dd
      rm -rf $${DDIR}
      mkdir -p $${DDIR}
      cp -r /examples/dd$${NODE_ID}/* $${DDIR}
      cp /examples/dd$${NODE_ID}/permissioned-nodes.json $${DDIR}/static-nodes.json
      cp $${DDIR}/static-nodes.json $${DDIR}/permissioned-nodes.json
      cat $${DDIR}/static-nodes.json
      GENESIS_FILE="/examples/dd$${NODE_ID}/genesis.json"
      NETWORK_ID=$$(cat $${GENESIS_FILE} | grep chainId | awk -F " " '{print $$2}' | awk -F "," '{print $$1}')
      EXTRA_ARGS="${QUORUM_GETH_ARGS:-}"
      geth --datadir $${DDIR} init $${GENESIS_FILE}
     geth \
        --emitcheckpoints --istanbul.blockperiod 1 --mine --minerthreads 1 --syncmode full \
        --identity node$${NODE_ID}-${QUORUM_CONSENSUS:-istanbul} \
        --datadir $${DDIR} \
...

So, DDIR will be deleted every time the quorum node restarts again.

joaoluis-pdm commented 2 years ago

Also, after a reboot of ctr-dev-pl, the ethAdapter and epirus dockers seems not to be starting up.

joaoluis-pdm commented 2 years ago

ethAdapter works well stop/start:

jpsl@khaki:/export/home/jpsl/develop/PharmaLedger/ctr-workspace/ctr-patient/blockchain-node/quorum-docker/ethAdapter$ docker-compose stop
Stopping ethAdapter ... done
jpsl@khaki:/export/home/jpsl/develop/PharmaLedger/ctr-workspace/ctr-patient/blockchain-node/quorum-docker/ethAdapter$ docker-compose start
Starting ethAdapter ... done

and CTR is able to login again (and see the data).

Update: There where some negative tests, but they were executed on a CPU-overloaded PC and they were non-reproducible.

joaoluis-pdm commented 2 years ago

At this point, all dockers should restart after reboot.

joaoluis-pdm commented 2 years ago

Restart confirmed on Ubuntu laptop environment.

joaoluis-pdm commented 2 years ago

Trying out @fdamiao-pdmfc changes to https://github.com/PharmaLedger-IMI/quorum-docker/blob/e8b03aa15523263de739985ba5981df50c179b23/quorum/docker-compose.yml to init the chain only the first time that the entrypoint is running, by testing that folder /qdata/dd (mapped to host /quorum/qdata/dd[1234]) already exists.

joaoluis-pdm commented 2 years ago

@fdamiao-pdmfc I tryed a minimal set of changes at ee4143fd8fd996f62165033e7c4c50b61140e66a

It is working for reads. (After a docker-compose stop/start reads seem to work well).

But is not working for writes. (It is blocking a long time on writes, and I did not figure out where to find error details... besides the ECONNRESET on the ethAdapter)

joaoluis-pdm commented 2 years ago

@fdamiao-pdmfc proposes a workaround for the stop/start resilience:

# before starting geth for an existing DDIR
sleep 5 $${NODE_ID}

image

joaoluis-pdm commented 2 years ago

Epirus is now broken. image

This could be due to 33b29526849a1230ddc90a6285c2468b2bf0dec8

joaoluis-pdm commented 2 years ago

v0.2.5 is the last planned version compatible with CTR.

v0.3.0 will be the next developed in master using the new smart contract and ethAdapter to be compatible with FGT.

joaoluis-pdm commented 2 years ago

v0.2.4 / v0.2.5 was the last version to work with CTR.

FGT needs a more recent smart contract, and so v0.3.0 is made for

psk-release      6f5ad4c50f6eea9589a5eaeaf056767c4a43d2b8     Thu Feb 17 11:50:54 2022 +0200
ethadapter       a63308f5ffe1182311dc10b6e49473727b8acc99      Mon Mar 14 15:45:02 2022 +0200
epi-workspace adac48270eef5629ab2134ea3fc50be2da5e9f02      Wed Mar 16 17:05:55 2022 +0200
joaoluis-pdm commented 2 years ago

v0.3.0 release for

psk-release      e98392eff7fd268409e642a4f5f1c995ffd5f9de          Tue Mar 8 00:58:24 2022 +0000
ethadapter       a63308f5ffe1182311dc10b6e49473727b8acc99      Mon Mar 14 15:45:02 2022 +0200
epi-workspace adac48270eef5629ab2134ea3fc50be2da5e9f02      Wed Mar 16 17:05:55 2022 +0200
joaoluis-pdm commented 2 years ago

CTR is not operation with old psk-release. Delay CTR support until needed.

This issue is considered done.