mesg-foundation / js-sdk

Javascript mono-repo with all the tools to interact with MESG
https://mesg.com
4 stars 4 forks source link

Change path for local blockchain state #197

Closed antho1404 closed 4 years ago

antho1404 commented 4 years ago

dependency: https://github.com/mesg-foundation/js-sdk/pull/196

The local state (.mesg directory) is now located in the dataDir of the user and not the current path.

https://oclif.io/docs/config

dataDir - CLI data directory Unix: ~/.data/mycli Windows: %LOCALAPPDATA%\mycli Can be overridden with XDG_DATA_HOME

I also removed the flag in order to simplify the cli and the configFile was not read anyway by the engine.

NicolasMahe commented 4 years ago

I now have weird behavior when even if the command service:dev works without issue, it doesn't stop the engine and remove the .mesg. The pid.json file still exists as well as the engine's config and files. The pid.json file contains:

[86371,86380]
NicolasMahe commented 4 years ago

When the command service:dev throws an error, the engine is not stopped and the next use of service:dev doesn't stop the engine and the running service:

➜  js-sdk git:(bug/config-path) ./packages/cli/bin/run service:dev ../services/service-ethereum
  ✔ Start environment
  ✔ Compiling service
  ✖ Creating service
    → out of gas: out of gas in location: WritePerByte; gasWanted: 300000, gasUsed: 347768
    Starting service
    Fetching service's logs
Error: out of gas: out of gas in location: WritePerByte; gasWanted: 300000, gasUsed: 347768
    at API.<anonymous> (~/Development/MESG/js-sdk/packages/api/lib/lcd.js:58:23)
    at Generator.next (<anonymous>)
    at fulfilled (~/Development/MESG/js-sdk/packages/api/lib/lcd.js:5:58)

➜  js-sdk git:(bug/config-path) ./packages/cli/bin/run service:dev ../services/service-emit-event-interval
  ✔ Start environment
  ✔ Compiling service
  ✔ Creating service
  ✔ Starting service
  ✔ Fetching service's logs
(node:1) UnhandledPromiseRejectionWarning: Error: 2 UNKNOWN: create event: data invalid request: instance "En6ewB6q5Gh5s7V7E4ftTzkbFSV2ozeHgTB8QN7wMWAv" not found
    at Object.exports.createStatusError (/app/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:1209:28)
    at InterceptingListener._callNext (/app/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/app/node_modules/grpc/src/client_interceptors.js:847:24)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
EVENT[every_2_seconds]: {"timestamp":1584706450623}
EVENT[every_1_second]: {"timestamp":1584706450638}
EVENT[every_1_second]: {"timestamp":1584706451643}
EVENT[every_2_seconds]: {"timestamp":1584706452623}
EVENT[every_1_second]: {"timestamp":1584706452646}
EVENT[every_5_seconds]: {"timestamp":1584706453623}
EVENT[every_1_second]: {"timestamp":1584706453648}
EVENT[every_2_seconds]: {"timestamp":1584706454591}
EVENT[every_1_second]: {"timestamp":1584706454615}
^C  ✔ Stopping logs
  ✔ Stop environment
 ›   Warning: Event stream error: 1 CANCELLED: Cancelled
 ›   Warning: Result stream error: 1 CANCELLED: Cancelled

➜  js-sdk git:(bug/config-path) docker service list
]ID                  NAME                                                  MODE                REPLICAS            IMAGE                                                                     PORTS
fmp8nhmaj1co        engine                                                replicated          1/1                 mesg/engine                                                               *:1317->1317/tcp, *:26656->26656/tcp, *:50052->50052/tcp
iitonbjnjx28        engine-8nMhm14WhFSZr2dGAgrH1xe86mUZLrQUNY2jnbBzoQ3G   replicated          1/1                 sha256:d84c5f68c5994d42bdc2aab41a88e8a457f86380b26fd051f90adc321ad115b4
antho1404 commented 4 years ago

first issue fixed and second in a new issue https://github.com/mesg-foundation/js-sdk/issues/201