-
Notifications
You must be signed in to change notification settings - Fork 867
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
Post Merge checkpoint sync #4735
Conversation
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…troller Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
# Conflicts: # besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java # ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineForkchoiceUpdated.java
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…earhead-checkpoint-sync
…earhead-checkpoint-sync
besu/src/test/java/org/hyperledger/besu/cli/options/SynchronizerOptionsTest.java
Outdated
Show resolved
Hide resolved
return configOptions.getTerminalTotalDifficulty().isPresent() | ||
&& configOptions.getCheckpointOptions().isValid() | ||
&& (UInt256.fromHexString(configOptions.getCheckpointOptions().getTotalDifficulty().get()) | ||
.greaterThan(configOptions.getTerminalTotalDifficulty().get())); |
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.
What happens if we're using a devnet or a new public testnet that starts with TTD = 0? I think every block's TD will be 0 and this condition will never be met?
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.
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.
As discussed current besu codebase requires a genesis block difficulty 1 so every block will have TotalDifficulty 1 in this case.
consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/PostMergeContext.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionContext.java
Show resolved
Hide resolved
return configOptions.getTerminalTotalDifficulty().isPresent() | ||
&& configOptions.getCheckpointOptions().isValid() | ||
&& (UInt256.fromHexString(configOptions.getCheckpointOptions().getTotalDifficulty().get()) | ||
.greaterOrEqualThan(configOptions.getTerminalTotalDifficulty().get())); |
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.
Does changing this back to >= mean @jframe's point about the TransitionController being needed on the boundary case become an issue again?
#4735 (comment)
Maybe we need a special case for TTD = 0.
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.
Added a test and another check for that case
consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/PostMergeContext.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
# Conflicts: # besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java # consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeContext.java # consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/PostMergeContext.java # ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineForkchoiceUpdated.java # ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayload.java
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
postMergeContext.setSyncState(null); | ||
assertThat(postMergeContext.isSyncing()).isTrue(); | ||
|
||
// after setting a syncState things should progress as expected. |
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.
nit: I would split these up into separate tests, maybe one with null input, one for returning true, one for returning false.
.greaterThan(configOptions.getTerminalTotalDifficulty().get())); | ||
} | ||
|
||
private boolean isMergeAtGenesis(final Optional<UInt256> 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.
nit: can we avoid mentioning the merge? I think proofOfStakeAtGenesis would be better, if that makes sense here.
Appreciate merge is mentioned a lot elsewhere, but not in this class yet I don't think?
} | ||
|
||
@Test | ||
public void preMergeCheckpointSyncUsesTransitionControllerBuilder() { |
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.
nice, tests looking good!
.lessOrEqualThan(value)) { | ||
throw new InvalidConfigurationException( | ||
"Near head checkpoint sync requires a block with total difficulty greater than the 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.
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?
Signed-off-by: Jason Frame <jason.frame@consensys.net> Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
# Conflicts: # besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
Merged as #4844 |
PR description
Add post-merge checkpoint sync support
Fixed Issue(s)
Fixes #4573
Linked to #4703
Documentation
doc-change-required
label to this PR ifupdates are required.
Changelog