Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix check for consensus algorithm to address broken RAFT timestamp in console #1616

Merged
merged 1 commit into from
May 19, 2023

Conversation

vdamle
Copy link
Contributor

@vdamle vdamle commented Mar 1, 2023

  • Geth console shows Invalid Date for RAFT blocks
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.2-stable-6c76d816(quorum-v22.4.4)/linux-amd64/go1.16.15
coinbase: 0xf9690dfd534d31bb3fbe26133a96438c6a218f7f
at block: 6 (Invalid Date)
 datadir: /qdata/ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 quorumExtension:1.0 raft:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d

The updated code in Geth 1.10 removed Consensus field from Node information and the protocol manager that ensured the field is set doesn't exist anymore. So the output of admin_nodeInfo no longer contains information about the consensus algorithm. Due to this, the adjustment to RAFT block timestamps is not applied.

In this PR, I propose using the output of rpc_modules API call to determine which consensus algorithm is in force. I made sure I am consistent with the previous method used to determine the consensus algorithm.

Code references:

* Use loaded rpc modules to deduce which consensus algorithm is running.
* Previous use of nodeInfo isn't valid anymore as those fields were
  removed in Geth 1.10 and the protocol manager that ensured the
  field is set doesn't exist anymore
@vdamle
Copy link
Contributor Author

vdamle commented Mar 1, 2023

  • Console output with fix applied to a RAFT node:
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.3-stable-e73afc9b(quorum-v22.7.6)/linux-amd64/go1.19.6
coinbase: 0x2f220867fc65bce0d25ef73a38b43e065103c96a
at block: 1 (Tue Feb 28 2023 20:22:29 GMT+0000 (UTC))
 datadir: /qdata/ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 quorumExtension:1.0 raft:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d
>
  • Console output with fix applied to a node running IBFT (to ensure no regression):
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.3-stable-e73afc9b(quorum-v22.7.6)/linux-amd64/go1.19.6
coinbase: 0x75aaa58c14d48da9f823f8d5633437d655d84277
at block: 3535 (Wed Mar 01 2023 17:37:36 GMT+0000 (UTC))
 datadir: /qdata/ethereum
 modules: admin:1.0 debug:1.0 eth:1.0 istanbul:1.0 miner:1.0 net:1.0 personal:1.0 quorumExtension:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d

@antonydenyer
Copy link
Contributor

Shouldn't we be looking to bring back the changes in https://github.com/ConsenSys/quorum/blob/v21.4.2/eth/handler.go#L1005-L1035
?

With the way you've implemented I think you can have the wrong consensus reported if you haven't enabled the rpc module.

@vdamle
Copy link
Contributor Author

vdamle commented Mar 10, 2023

@antonydenyer Agree, but in such cases, the console is no more broken than what it is currently..

I'm not against bringing back the original changes, I made the assumption that nodes not running with rpc modules enabled is likely is a remote possibility given most IBFT/RAFT info & administrative APIs require access to the rpc methods. Will take a stab at what you've suggested next week.

@Krish1979 Krish1979 merged commit fbfb5dd into Consensys:master May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants