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

correct fallback ttd to correct value #4223

Merged
merged 4 commits into from
Aug 7, 2022

Conversation

daniellehrner
Copy link
Contributor

Signed-off-by: Daniel Lehrner [email protected]

PR description

The fallback TTD for mainnet had off-by-one error. We need to set it to 2^256 - 2^10, but our code was

Difficulty.MAX_VALUE.subtract(UInt256.valueOf(1024L)

The problem is that MAX_VALUE is 2^256 - 1, not 2^256. So we were calculating in the end 2^256 - 1 - 2^10.

This PR replaces the calculation with the hard coded value as hex in the config and as decimal in the test.

I confirmed the value with the mainnet genesis file for the consensus clients: https://github.com/ethereum/consensus-specs/blob/981b05afb01d5b19be3a5a60ccb12c3582e4c0cf/configs/mainnet.yaml#L16

Fixed Issue(s)

fixes #4220

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

@daniellehrner daniellehrner marked this pull request as ready for review August 5, 2022 10:39
Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@macfarla macfarla enabled auto-merge (squash) August 7, 2022 22:54
@macfarla macfarla merged commit ca9a076 into hyperledger:main Aug 7, 2022
codyborn pushed a commit to codyborn/besu that referenced this pull request Aug 8, 2022
* correct fallback ttd to correct value

Signed-off-by: Daniel Lehrner <[email protected]>

Co-authored-by: Sally MacFarlane <[email protected]>
codyborn pushed a commit to codyborn/besu that referenced this pull request Aug 8, 2022
* correct fallback ttd to correct value

Signed-off-by: Daniel Lehrner <[email protected]>

Co-authored-by: Sally MacFarlane <[email protected]>
Signed-off-by: Cody Born <[email protected]>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* correct fallback ttd to correct value

Signed-off-by: Daniel Lehrner <[email protected]>

Co-authored-by: Sally MacFarlane <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mainnet Besu v22.7.0 API Execution Engine and Lighthouse v2.5.1 TTD override values do not match
3 participants