Connect a second node to a local testnet fails
vrde opened this issue · 15 comments
After setting up the first node, we tried to connect a second node to the network.
This is the output of the second node.
➜ run-a-node DEBUG=tendermint,leap-node* leap-node --config=local-conf.json
leap-node Syncing events... +0ms
unhandledRejection Error: Returned values aren't valid, did it run Out of Gas?
at ABICoder.decodeParameters (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-eth-abi/src/index.js:226:15)
at Contract._decodeMethodReturn (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-eth-contract/src/index.js:465:22)
at Method.outputFormatter (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-eth-contract/src/index.js:818:46)
at Method.formatOutput (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-core-method/src/index.js:163:54)
at sendTxCallback (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-core-method/src/index.js:473:33)
at /home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-core-requestmanager/src/index.js:147:9
at XMLHttpRequest.request.onreadystatechange (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/web3-providers-http/src/index.js:96:13)
at XMLHttpRequestEventTarget.dispatchEvent (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)
at XMLHttpRequest._setReadyState (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)
at XMLHttpRequest._onHttpResponseEnd (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/xhr2-cookies/dist/xml-http-request.js:318:14)
at IncomingMessage.<anonymous> (/home/vrde/.local/n/lib/node_modules/leap-node/node_modules/xhr2-cookies/dist/xml-http-request.js:289:61)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
does second node run on the same machine?
if it is on a different machine, you have to change URL for root chain in config file (it is localhost for local env)
if is on the same machine, you have to use dataPath
cli arg
Given the error, I suspect you have localhost
in a network config for root chain
Nodes were on different machines. What I did was
curl --data '{"method":"plasma_getConfig","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST 192.168.178.163:9645 > local-conf.json
I've manually patched the config file to point to the correct rootNetwork
:
{
"exitHandlerAddr": "0xA92267339010CfB9cf6076361a4170ea2F6D9244",
"bridgeAddr": "0x4423B957b267cf3A4D0cf2dfE211068F89A514f9",
"operatorAddr": "0xd18995d22c70A1E17A6E444D06Ee9EdBd33cA35a",
"rootNetwork": "http://192.168.178.163:9545",
"rootNetworkId": 5777,
"network": "development",
"networkId": 374917198,
"eventsDelay": 2,
"bridgeDelay": 6,
"version": "v5.3.3",
"genesis": {
"genesis_time": "2019-11-01T12:45:48.707277Z",
"chain_id": "test-chain-7wW8KX",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": { "max_age": "100000" },
"validator": { "pub_key_types": ["ed25519"] }
},
"validators": [
{
"address": "AB764D3AAC2982A6A2D8BBB8914C94B39DB444A2",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "wj95A2DTxefEbNzCA+DNQgqH/rK+Kqi6F8ayiluRF10="
},
"power": "10",
"name": ""
}
],
"app_hash": ""
},
"peers": ["e157a7b646355926e65fa4ea567206dabea20e7c@192.168.178.163:53495"]
}
is ganache listening on 192.168.178.163:9545 ? Can you telnet 192.168.178.163 9545
?
You man need to use -h
option for ganache. From https://github.com/trufflesuite/ganache-cli:
-h or --host or --hostname: Hostname to listen on. Defaults to 127.0.0.1 (defaults to 0.0.0.0 for Docker instances of ganache-cli).
On a different note, I also recommend --blockTime 1
option for ganache — it worked better for me this way in integration tests.
Yes I was able to connect to ganache, the node running it was also running an old school socat socat tcp-listen:9545,reuseaddr,fork tcp:localhost:8545
, just to avoid rebooting the node.
IMO the ganache version was old and had troubles with events. @johannbarbie can you please tell us the version of Ganache you were using?
On a different note, I also recommend
--blockTime 1
option for ganache — it worked better for me this way in integration tests.
That's a good idea!
ganache v2.0.0
I'm using the following version of ganache-cli
Ganache CLI v6.4.2-beta.0 (ganache-core: 2.5.4-beta.2)
Integration tests use ganache-cli@6.6.0
Returned values aren't valid, did it run Out of Gas?
This my be also a symptom of ABI mismatch. Can you check both versions of leap-node are the same?
Yes we are running the same version of leap-node
. I smell a problem with Ganache, so I'd press ⏸️ on this issue and come back when we try ganache-cli
or my 👶 ethnode
I'm able to reproduce it locally without the need to connect to a second node.
The parameter rootNetwork
(deprecated in the README.md
file) is ignored by the BridgeState
constructor:
Lines 25 to 28 in 1a0173c
Since the generatedConfig
is configured with a chainId
equal to 5777
, the BridgeState is initialized with the matching http endpoint:
leap-node/src/utils/networks.js
Lines 57 to 62 in 1a0173c
Proposed solution: make rootNetwork
optional, not deprecated. If present, rootNetwork
is used. If not, then the fallback endpoint in networks.js
is used. And this would allow a node operator to connect to their ethereum node instead of relying on infura.
agree. Would be good to get rid of rootNetworkId
whatsover. Don't really know yet how the node is supposed when it fetches config from the remote node (like --config=https://localhost:7000
)