Consensys / quorum

A permissioned implementation of Ethereum supporting data privacy
https://www.goquorum.com/
GNU Lesser General Public License v3.0
4.68k stars 1.29k forks source link

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

Closed drandreaskrueger closed 4 years ago

drandreaskrueger commented 6 years ago

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 commented 6 years ago

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

Thanks.

fixanoid commented 6 years ago

Good suggestions.

fixanoid commented 6 years ago

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

jpmsam commented 6 years ago

@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.

drandreaskrueger commented 6 years ago

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:

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 commented 6 years ago

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
    }
  }
}
fixanoid commented 4 years ago

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