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

Add total_difficulty to header #1191

Open
pedrohba1 opened this issue Mar 1, 2024 · 1 comment
Open

Add total_difficulty to header #1191

pedrohba1 opened this issue Mar 1, 2024 · 1 comment
Labels
shelf-stable Will not be closed by stale-bot

Comments

@pedrohba1
Copy link

pedrohba1 commented Mar 1, 2024

Other block header structs have this field called total_difficulty. Can it be added to the Header in /src/types/execution/header.rs ?

    /// TotalDifficulty is the sum of all previous blocks difficulty including this block difficulty.
    ///
    /// If the Block containing this `BlockHeader` has been produced using the Proof of Stake
    /// consensus algorithm, this field will actually be constant and set to the terminal total difficulty
    /// that was required to transition to Proof of Stake algorithm, which varies per network. It is set to
    /// 58 750 000 000 000 000 000 000 on Ethereum Mainnet and to 10 790 000 on Ethereum Testnet Goerli.
    #[prost(message, optional, tag = "17")]
    pub total_difficulty: ::core::option::Option<BigInt>,
@njgheorghita
Copy link
Collaborator

Total difficulty is not an actual field of the header structure unlike difficulty which is an actual field of the header structure. Execution clients calculate the total difficulty in memory as they process all of the headers from genesis to latest. Given that portal clients do operate in a similar fashion, there is no straightforward way to calculate the total difficulty for a given height. This is a problem that will need to be solved once we turn our attention to supporting eth_* jsonrpc endpoints. Off the top of my head, I can't recall, but I do remember some proposals for how to achieve this, given a portal client's unique architecture. However, this is not a priority at the moment.

@KolbyML KolbyML added the shelf-stable Will not be closed by stale-bot label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
shelf-stable Will not be closed by stale-bot
Projects
None yet
Development

No branches or pull requests

3 participants