quorum icon indicating copy to clipboard operation
quorum copied to clipboard

(feature request) let node answer that it is (a) quorum, and (b) running on raft

Open drandreaskrueger opened this issue 8 years ago • 7 comments

I am missing an essential answer in the quorum client.

Have a look at this Python code (it assumes the 7nodes example running):

from web3 import Web3, HTTPProvider  # pip3 install web3
w3 = Web3(HTTPProvider('http://localhost:22001'))
print ("version.node = ", w3.version.node)
print ("version.ethereum = ", w3.version.ethereum)
print ("version.network = ", w3.version.network)
print ("version.api = ", w3.version.api)

version.node = Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3
version.ethereum = 63
version.network = 1
version.api = 4.2.0

I would like to ask one more question, like this

print ("version.consensus = ", w3.version.consensus)

version.consensus = raft/version-xyz

Or like this:

print ("version.flavour = ", w3.version.flavour)

version.flavor = quorum/2.0.2/raft/version-xyz

Or even simpler (but that could break other people's code):

print ("version.node = ", w3.version.node)

version.node = Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3/Quorum/v2.0.2/raft/v.X.Y.Z

because for my chainhammer I have to hardcode RAFT=True at the moment; but now I am going to extend it to different BFTs and clients.

I am sure the node itself knows that it is running raft, or IBFT, or whatever - right?

TL;DR:

Minimal: Please extend the quorum RPC API somehow
with an answer ("Quorum", "raft"), or ("Quorum, "IBFT").

Thanks a lot.

drandreaskrueger avatar May 08 '18 16:05 drandreaskrueger

Or is there another RPC call that I am unaware of, that is already returning this type of information?

Thanks.

drandreaskrueger avatar May 16 '18 09:05 drandreaskrueger

Good suggestions.

fixanoid avatar May 18 '18 18:05 fixanoid

We used to expose quorum API and we do accept isQuorum in the genesis block, but these are not currently exposed through APIs.

fixanoid avatar May 18 '18 18:05 fixanoid

@drandreaskrueger you can add the raft api --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,quorum,raft in the start up script and invoke the role method curl -X POST --data '{"jsonrpc":"2.0", "method": "raft_role", "id": 1}' localhost:22000

If the response isn't an error, then it's quorum in raft mode. Istanbul has a similar api.

jpmsam avatar May 26 '18 06:05 jpmsam

Perfect, that is exactly what I had hoped for.

I have added it to raft-start.sh#L11, please you add that to the parent fork, thanks.

I have now begun a clienttype.py#L71-98 script, which already recognizes raft.

Next:

  • Quorum pretends to be Geth. Querying web3.version.node --> Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3. Is there any call that I could reliably use to identify Quorum?
  • IBFT - yes, I found the istanbul API functions here - which one do you suggest to use?
  • IBFT / raft / PoW / ... idea1: isn't there also a version number that is unique to the consensus algorithm? Why not simply return that version number, e.g. {..., "raft": {"version" : "1.0", ...}, ...}, etc.
  • IBFT idea2 - admin_nodeInfo:

admin_nodeInfo could be useful, in case of IBFT I get:

protocols--> 'istanbul'

admin_nodeInfo:
{...
 'name': 'Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3',
 'protocols': {'istanbul': {'difficulty': 3,
                            'genesis': '0x62c2c0637834d11d6af010379a4e1a24408672185edda0b3f0dae6c1f95a3c94',
                            'head': '0x7056ab3c298b28ff0eda65cd63cde973ed3ee81de862c2cbb022c828b30b1b9d',
                            'network': 1}}}

but in case of raft it unfortunately pretends to be eth:

protocols--> 'eth'

{... 'name': 'Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3',
 'protocols': {'eth': {'difficulty': 0, ... 'genesis': ...}}

which is probably what the vanilla geth returns too, right?

Could that be made more consistent?

Thanks a lot, the "raft_role" is really useful, and exactly what I had hoped for.

drandreaskrueger avatar May 29 '18 11:05 drandreaskrueger

protocols--> 'eth'
...
which is probably what the vanilla geth returns too, right?

yes:

admin.nodeInfo
{
  enode: "enode://849...@[::]:30303",
  id: "849...",
  ip: "::",
  listenAddr: "[::]:30303",
  name: "Geth/v1.8.14-unstable/linux-amd64/go1.10.3",
  ports: {
    discovery: 30303,
    listener: 30303
  },
  protocols: {
    eth: {
      config: {
        byzantiumBlock: 4370000,
        chainId: 1,
        daoForkBlock: 1920000,
        daoForkSupport: true,
        eip150Block: 2463000,
        eip150Hash: "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0",
        eip155Block: 2675000,
        eip158Block: 2675000,
        ethash: {},
        homesteadBlock: 1150000
      },
      difficulty: 17179869184,
      genesis: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
      head: "0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",
      network: 1
    }
  }
}

drandreaskrueger avatar Aug 13 '18 12:08 drandreaskrueger

Closing as the series of upgrades between last update on this issue and commits into repo address this.

fixanoid avatar Jan 31 '20 18:01 fixanoid