-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Post Merge checkpoint sync #4735
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
Changes from 43 commits
e28c563
7ca71f9
d926c17
737af27
5a6afd4
c00c0c4
c17c354
d74f9cb
cd8bbd3
a8026e1
0038b37
11d73af
ed0c55a
428f2ef
216d3bd
6d514b9
6ee5296
ee19889
6eec853
2ff6786
4b9028d
afeda6c
af7f0d5
d207c47
7b2e85b
6b454ba
3a00e41
b11ab44
d7eb1c2
cb5ebb7
cebc22b
f9b7d95
05e9c30
43ac009
0937714
19e2a15
43ae7b3
54f603a
288ed54
2979bb0
34b3f90
4b26c76
f824ff4
d2720e8
6cad478
42e5f4c
32a047c
cbd9d1a
3ae9e25
406a069
8521822
bd467a1
928f008
6810c3c
18d29ca
34f0b9d
8c7411b
3ccfec0
7b56639
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ | |
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import org.apache.tuweni.units.bigints.UInt256; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
|
|
@@ -211,6 +212,10 @@ BesuControllerBuilder fromGenesisConfig( | |
| throw new IllegalArgumentException("Unknown consensus mechanism defined"); | ||
| } | ||
|
|
||
| if (isCheckpointBlockTotalDifficultyGreaterOrEqualThanTTD(configOptions)) { | ||
| return new MergeBesuControllerBuilder().genesisConfigFile(genesisConfig); | ||
| } | ||
|
|
||
| // wrap with TransitionBesuControllerBuilder if we have a terminal total difficulty: | ||
| if (configOptions.getTerminalTotalDifficulty().isPresent()) { | ||
|
gfukushima marked this conversation as resolved.
|
||
| // TODO this should be changed to vanilla MergeBesuControllerBuilder and the Transition* | ||
|
|
@@ -258,5 +263,13 @@ private Long readQbftStartBlockConfig(final QbftConfigOptions qbftConfigOptions) | |
|
|
||
| return startBlock; | ||
| } | ||
|
|
||
| private boolean isCheckpointBlockTotalDifficultyGreaterOrEqualThanTTD( | ||
| final GenesisConfigOptions configOptions) { | ||
| return configOptions.getTerminalTotalDifficulty().isPresent() | ||
| && configOptions.getCheckpointOptions().isValid() | ||
| && (UInt256.fromHexString(configOptions.getCheckpointOptions().getTotalDifficulty().get()) | ||
| .greaterOrEqualThan(configOptions.getTerminalTotalDifficulty().get())); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does changing this back to >= mean @jframe's point about the TransitionController being needed on the boundary case become an issue again? Maybe we need a special case for TTD = 0.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a test and another check for that case |
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a special case here as well for genesisTD = 0 = TTD?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you successfully tested a post-merge genesis with this code?