Closed Giulio2002 closed 2 months ago
Besu still supports PoW (for ETC for example). It would be less than ideal to have to have chain-specific rpc header response formats, but it would not be the end of the world if the rest of the EL clients signal they would prefer to drop total difficulty.
``
Context
With Ethereum's transition from Proof of Work (PoW) to Proof of Stake (PoS) through the Ethereum 2.0 upgrade, the role of certain fields in the blockchain's schema has fundamentally changed. Specifically, the
totalDifficulty
field, which played a crucial role in chain selection and synchronization under PoW, is no longer relevant in the PoS consensus mechanism.Motivation
Obsolescence in PoS
totalDifficulty
was essential for determining the canonical chain by identifying the chain with the highest cumulative difficulty. This metric was critical for chain selection and block validation.totalDifficulty
no longer plays any role in the core protocol's operation.Redundancy in JSON-RPC
totalDifficulty
in theBlock
schema within the JSON-RPC interface introduces unnecessary redundancy. Since the field is no longer required for synchronization, verification, or any critical protocol operations, its presence serves no practical purpose.Opportunities for Refactoring
totalDifficulty
field from the JSON-RPC, client teams can gradually remove dependencies on outdated concepts. This opens the door to cleaner, more efficient codebases that are easier to maintain and extend.Current usage in application
For as far as I was able to gather (I still need to get more input on this), the 2 places were
totalDifficulty
is useful in the jsonrpc are:Block explorers
Although
totalDifficulty
is used by block explorers, it is probably not so useful information to display. Additionally, Block explorers do not directly query the node but create their own indexing from the json RPC. Therefore, creating a new indexing fortotalDifficulty
should be trivial if it is deemed of critical importance.Transition hive tests
the
totalDifficulty
field is checked in hive tests for engine api transition but such check is mostly something extra and can be safely removed (albeit it will reduce the insights of merge transition).