rchain-community / rchain-api

An API for rchain dapps to communicate with the blockchain
Other
22 stars 12 forks source link

addBlock crashes with TypeError on ReadOnlyMode #34

Open dckc opened 5 years ago

dckc commented 5 years ago

The real issue is:

$ rnode propose
Response: Error while creating block: ReadOnyMode

but using rchain-api, I get:

$ rclient propose -v
options: { '--help': false,
  '--host': 'localhost',
  '--port': '40401',
  '--verbose': true,
  RHOLANG: null,
  deploy: false,
  propose: true }
failed to propose to localhost:40401: Cannot read property 'blockHash' of undefined
TypeError: Cannot read property 'blockHash' of undefined
    at Type.BlockMessage$fromObject [as fromObject] (eval at Codegen (/home/connolly/projects/RChain-API/node_modules/@protobufjs/codegen/index.js:50:33), <anonymous>:7:8)
    at Type.fromObject (/home/connolly/projects/RChain-API/node_modules/protobufjs/src/type.js:538:25)
    at serialize (/home/connolly/projects/RChain-API/node_modules/@grpc/proto-loader/build/src/index.js:55:27)
    at Object.final_requester.sendMessage (/home/connolly/projects/RChain-API/node_modules/grpc/src/client_interceptors.js:802:37)
    at InterceptingCall._callNext (/home/connolly/projects/RChain-API/node_modules/grpc/src/client_interceptors.js:418:43)
    at InterceptingCall.sendMessage (/home/connolly/projects/RChain-API/node_modules/grpc/src/client_interceptors.js:460:8)
    at InterceptingCall._callNext (/home/connolly/projects/RChain-API/node_modules/grpc/src/client_interceptors.js:424:12)
    at InterceptingCall.sendMessage (/home/connolly/projects/RChain-API/node_modules/grpc/src/client_interceptors.js:460:8)
    at ServiceClient.Client.makeUnaryRequest (/home/connolly/projects/RChain-API/node_modules/grpc/src/client.js:498:21)
    at apply (/home/connolly/projects/RChain-API/node_modules/lodash/lodash.js:478:17)
dckc commented 5 years ago

@JoshOrndorff is unable to reproduce

he started a node without casper (rnode run -s -n) and tried to deploy (by running node rhopm.js --package exampleProject/powers.rho)

It failed with a reasonable diagnostic:

(node:6644) UnhandledPromiseRejectionWarning: Error: Error while creating block: ReadOnyMode
    at responseP.then (/home/joshy/ProgrammingProjects/rhopm/node_modules/rchain-api/rnodeAPI.js:156:38)

version: It's the same rhopm that's the tip of master on my github and rchain-api 0.7.1-beta.2

JoshOrndorff commented 5 years ago

Was this actually using addBlock or was it createBlock? I believe createBlock is the equivalent service of rnode propose.