rchain-community / rchain-api

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

listenForDataAtName not working #59

Closed fabcotech closed 5 years ago

fabcotech commented 5 years ago

Hi !

I'm running the last version of rnode (0.8.3), and a fresh install of rchain-api.

When running node test/liveRNodeTest.js rnode-test.rhobot.net 50000 Which is a test tu post data on-chain and then read it through a GRPC call. I've got an error and the test fails:

$ node test/liveRNodeTest.js rnode-test.rhobot.net 50000

{ endpoint: { host: 'localhost', port: 40401 } }
doDeploy result: Success!
TypeError: Cannot read property 'postBlockData' of undefined
    at integrationTest (/home/charles/dev/dappy-dev2/node_modules/rchain-api/test/liveRNodeTest.js:99:43)
    at <anonymous>

It seems that the listenForDataAtName call does not work :(

JoshOrndorff commented 5 years ago

When you run $ node test/liveRNodeTest.js rnode-test.rhobot.net 50000 it looks like trying the test against the node at rnode-test.rhobot.net on port 50000. In that case it wouldn't matter what version of rnode you're running, but what version is running on that server.

But for some reason it seems it is trying to deploy against your local node anyway based on endpoint: { host: 'localhost', port: 40401

I didn't remember that we supported testing against remote nodes, although it seems like a good idea.

JoshOrndorff commented 5 years ago

Looks like this is how the endpoint is calculated https://github.com/rchain-community/rchain-api/blob/master/test/liveRNodeTest.js#L139-L142

Not sure how to set those environment variables.

@dckc I guess you might be able to help with the environment variables?

In any case @fabcotech, can you confirm that the test passes when run against your local node?

fabcotech commented 5 years ago

I modified the endpoint variable so it points to my local rnode process:

  const endpoint = {
    host: "localhost",
    port: parseInt("40401", 10)
  };

The test fails with the same error. Do the tests pass on your machine ?

dckc commented 5 years ago

wishing for ci with a live node...

JoshOrndorff commented 5 years ago

Confirming @fabcotech 's experience on Debian 9.5, RNode 0.8.2, rchain-api a45d49fc360787e73724450b8771e1ec352c4ca2

RNode output was

17:52:17.126 [node-runner-16] INFO  c.r.casper.MultiParentCasperImpl - Received Deploy #1548543136942 -- new x0, x1 in {
  @{"publ...
dckc commented 5 years ago

npm run integrationTest is working for me now that #62 is done, and it includes listenForDataAtName, I'm pretty sure.

Let us know if not.