Enode creation failed in quorum v2.2.2 & v2.2.3
Hi there,
System information
Geth Version: 1.8.18-stable Quorum Version: 2.2.3 Architecture: amd64 Protocol Versions: [63 62] Network Id: 1337 Go Version: go1.10 Operating System: linux
Expected behaviour
Below command should create Enode id bootnode -nodekey nodekey 2>enode.txt &
Actual behaviour
Below command should create Enode id
bootnode -nodekey nodekey 2>enode.txt &
But enode.txt contains below message
"New local node record seq=1 id=a979970ff9ea2fad ip=
While adding new raft node with --raftjoinexisting $RAFTID ,getting this error in geth logs:
synchronizing with peer peer id=1 hash=21f956…ad3602 WARN [05-09|15:18:05.610] Synchronisation failed, retrying err="peer is unknown or unhealthy" INFO [05-09|15:18:05.610] failed to synchronize with peer peer id=b28dd1a26fc7792039ee3bf1ef1aec1e66bc35e2f35d0d359f678cc3499c6c83 INFO [05-09|15:18:06.110] synchronizing with peer peer id=1 hash=21f956…ad3602 WARN [05-09|15:18:06.111] Synchronisation failed, retrying err="peer is unknown or unhealthy" INFO [05-09|15:18:06.111] failed to synchronize with peer peer id=b28dd1a26fc7792039ee3bf1ef1aec1e66bc35e2f35d0d359f678cc3499c6c83
@abhayar Peer id 1 looks to be down, so you will get these error until its recovers.
bootnode utility should work correctly, please look at the instructions on this page: http://docs.goquorum.com/en/latest/Getting%20Started/Getting-Started-From-Scratch/
@fixanoid Node with raft id 1 is running, but while joining new raft node to existing it is throwing synechronization error with latest quroum v2.2.2 & v2.2.3.
Referring to the below image, id from admin.nodeInfo is different than enode. Ideally this should be same as enode from admin.nodeInfo

Hence showing below error:

Below screenshot of admin.nodeInfo used quorum v2.2.1

id from admin.nodeInfo is same as enode,
And for creation of enode failed, i created nodekey and enode manually by below commands, which uses quorum v2.2.1 as this commands failed in latest qourum.
bootnode -genkey nodekey bootnode -nodekey nodekey 2>enode.txt
@fixanoid @jbhurat Enode Creation issue is resolved. And for synchronization failed, found error in geth logs while adding static node. In enode string, tcp port is replaced to 0 and udp port (discport) is 22001. I think it should be reversed. Please refer below image.

Adding raft peer function calls from raft/handler.go // Add P2P connection: p2pNode := enode.NewV4(pubKey, address.Ip, 0, int(address.P2pPort), int(address.RaftPort)) pm.p2pServer.AddPeer(p2pNode)
Implementation of NewV4 function from enode/urlv4.go func NewV4(pubkey *ecdsa.PublicKey, ip net.IP, tcp, udp, raftPort int) *Node {} It assignes 0 to tcp port and network listening port to Udp .
So made changes in raft/handler.go file, Assigned 0 to udp port. And created quorum network with updated quorum changes. Issue is still pending.
Hi @abhayar, I just tried to add a new node by following the instructions documented at https://docs.goquorum.com/en/latest/Getting%20Started/Getting-Started-From-Scratch/ and I am able to add the node just fine and don't see any issues. You should generate the Enode id using bootnode --nodekey=new-node-1/nodekey --writeaddress as given in the documentation
@abhayar the ports are extracted from the string passed into raft.addPeer. The address should match correct ports as you have configured the node on, please see: https://docs.goquorum.com/en/latest/Getting%20Started/Getting-Started-From-Scratch/#adding-additional-node
@jbhurat @fixanoid Please find enode of master (1st raft node) node in admin.nodeInfo in below image where tcp port is 22001 and discport=0

And while adding static node from 2nd raft node, it adds master enode with tcp port=0 and discport=22001. Please find in below image:

I think because of this it is giving synchronization error:
Synchronisation failed, retrying err="peer is unknown or unhealthy"
INFO [05-17|07:40:41.437] failed to synchronize with peer peer id=43628db02b8d9620855864d1d48c9716d68fbfdf24a2100546310751a9455607
In Quorum version 2.2.3, tcp port is mapping to 0 and address.P2pPort is mapping to udp
raft/handler.go ::
// Add P2P connection:
p2pNode := enode.NewV4(pubKey, address.Ip, 0, int(address.P2pPort), int(address.RaftPort))
p2p/enode/urlv4.go ::
// NewV4 creates a node from discovery v4 node information. The record
// contained in the node has a zero-length signature.
func NewV4(pubkey *ecdsa.PublicKey, ip net.IP, tcp, udp, raftPort int) *Node
In Quorum version 2.2.1, tcp port is mapping to P2pPort and udp to 0
raft/handler.go ::
// Add P2P connection:
p2pNode := discover.NewNode(address.NodeId, address.Ip, 0, uint16(address.P2pPort))
pm.p2pServer.AddPeer(p2pNode)
p2p/discover/node.go ::
// NewNode creates a new node. It is mostly meant to be used for
// testing purposes.
func NewNode(id NodeID, ip net.IP, udpPort, tcpPort uint16) *Node
Hi @abhayar, I don't think the issue you are seeing is related to what you see in the logs.
I see the TCP port as 0 in the logs as you see
TRACE[05-17|11:21:37.505] Adding static node node="enode://0d8126e8c7510200108c2018bb0f4f30a5e288871129f83bd140c8f0f2e68fe39ba8d9b0a36c9ca284d9af34da5b1feeaeae4d2aedad87ee9195a5691d1e3403@127.0.0.1:0?discport=21007&raftport=50408"
But when I connect to the Geth console and query this node, I see everything is fine
> admin.nodeInfo
{
enode: "enode://0d8126e8c7510200108c2018bb0f4f30a5e288871129f83bd140c8f0f2e68fe39ba8d9b0a36c9ca284d9af34da5b1feeaeae4d2aedad87ee9195a5691d1e3403@127.0.0.1:21008?discport=0",
As mentioned above, I followed the steps given in our documentation to add the new node and it works fine. I am also able to send transactions to this new node just fine
@jbhurat, for every new node we have to maintain static-nodes.json with all existing node's enode and new enode and start new node with --raftjoinexisting
@abhayar, that's correct. For the new node, you would have to define static-nodes.json, with enode of existing nodes and start the new node with --raftjoinexisting flag
@jbhurat In quorum v2.2.1 or in previous versions, we maintain static-node.json only for master node and used --raftjoinexisting flag for new raft node. No need to maintain static-node.json file on all nodes. Is there any specific reason , we have to maintain staic-nodes.json file on all nodes alongwith --raftjoinexisting flag in quorum v2.2.2 and v2.2.3..?
@abhayar, you are right, static-nodes.json only for master node should work and you should be able to use --raftjoinexisting flag for a new raft node. I just tried it and worked as expected
@jbhurat, so new node started with flag & also connected to master node using quorum v2.2.3? In geth logs, connection refused error while adding static node (master node's enode which consists network listening port as 0 )is also not generated...?
Yes, the new node started with flag & also connected to master node using quorum v2.2.3 Below are the logs from my node:
- When I run
raft.addPeer()
TRACE[05-20|14:22:47.499] Adding static node node="enode://0d8126e8c7510200108c2018bb0f4f30a5e288871129f83bd140c8f0f2e68fe39ba8d9b0a36c9ca284d9af34da5b1feeaeae4d2aedad87ee9195a5691d1e3403@127.0.0.1:0?discport=21007&raftport=50408"
TRACE[05-20|14:22:47.499] New dial task task="staticdial c2adc643b1647562 127.0.0.1:0"
TRACE[05-20|14:22:47.499] Dial error task="staticdial c2adc643b1647562 127.0.0.1:0" err="dial tcp 127.0.0.1:0: connect: can't assign requested address"
DEBUG[05-20|14:22:47.499] Can't resolve node id=0x44d9440 err="discovery is disabled"
TRACE[05-20|14:22:47.499] Dial task done task="staticdial c2adc643b1647562 127.0.0.1:0"
TRACE[05-20|14:22:47.500] New dial task task="wait for dial hist expire (29.999997581s)"
2019-05-20 14:22:47.500549 I | rafthttp: started streaming with peer 8 (writer)
2019-05-20 14:22:47.501408 I | rafthttp: started streaming with peer 8 (writer)
2019-05-20 14:22:47.503313 I | rafthttp: started peer 8
2019-05-20 14:22:47.503343 I | rafthttp: added peer 8
2019-05-20 14:22:47.503356 I | rafthttp: started streaming with peer 8 (stream Message reader)
INFO [05-20|14:22:47.503] start snapshot applied index=8 last snapshot index=7
2019-05-20 14:22:47.503406 I | rafthttp: started streaming with peer 8 (stream MsgApp v2 reader)
- As the new node is not started yet, I see connection refused messages
2019-05-20 14:22:52.505929 W | rafthttp: health check for peer 8 could not connect: dial tcp 127.0.0.1:50408: connect: connection refused
2019-05-20 14:22:57.510112 W | rafthttp: health check for peer 8 could not connect: dial tcp 127.0.0.1:50408: connect: connection refused
- Once the new node is started
2019-05-20 14:24:58.365443 I | rafthttp: established a TCP streaming connection with peer 8 (stream Message writer)
2019-05-20 14:24:58.365998 I | rafthttp: established a TCP streaming connection with peer 8 (stream MsgApp v2 writer)
2019-05-20 14:24:58.428016 I | rafthttp: established a TCP streaming connection with peer 8 (stream Message reader)
And on the new raft node
INFO [05-20|14:24:58.118] New local node record seq=1 id=c2adc643b1647562 ip=127.0.0.1 udp=0 tcp=21008
INFO [05-20|14:24:58.119] Started P2P networking self="enode://0d8126e8c7510200108c2018bb0f4f30a5e288871129f83bd140c8f0f2e68fe39ba8d9b0a36c9ca284d9af34da5b1feeaeae4d2aedad87ee9195a5691d1e3403@127.0.0.1:21008?discport=0"
INFO [05-20|14:24:58.200] loading WAL term=0 index=0
INFO [05-20|14:24:58.206] startRaft raft ID=8
INFO [05-20|14:24:58.206] newly joining an existing cluster; waiting for connections.
And the below messages for every peer
INFO [05-20|14:24:58.363] applying snapshot to raft storage
INFO [05-20|14:24:58.363] updating cluster membership per raft snapshot
INFO [05-20|14:24:58.364] adding new raft peer raft id=1
2019-05-20 14:24:58.364195 I | rafthttp: starting peer 1...
2019-05-20 14:24:58.364225 I | rafthttp: started HTTP pipelining with peer 1
TRACE[05-20|14:24:58.364] Adding static node node="enode://ac6b1096ca56b9f6d004b779ae3728bf83f8e22453404cc3cef16a3d9b96608bc67c4b30db88e0a5a6c6390213f7acbe1153ff6d23ce57380104288ae19373ef@127.0.0.1:0?discport=21000&raftport=50401"
TRACE[05-20|14:24:58.364] New dial task task="staticdial 7577115fd9184a27 127.0.0.1:0"
2019-05-20 14:24:58.364467 I | rafthttp: started streaming with peer 1 (writer)
2019-05-20 14:24:58.364558 I | rafthttp: started streaming with peer 1 (writer)
Thanks @jbhurat, we will check it once again in our setup why synchronization is failing on tcp port 0 while adding static node.