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
| return configOptions.getTerminalTotalDifficulty().isPresent() | ||
| && configOptions.getCheckpointOptions().isValid() | ||
| && (UInt256.fromHexString(configOptions.getCheckpointOptions().getTotalDifficulty().get()) | ||
| .greaterThan(configOptions.getTerminalTotalDifficulty().get())); |
There was a problem hiding this comment.
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.
Added a test and another check for that case
There was a problem hiding this comment.
As discussed current besu codebase requires a genesis block difficulty 1 so every block will have TotalDifficulty 1 in this case.
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>
| return configOptions.getTerminalTotalDifficulty().isPresent() | ||
| && configOptions.getCheckpointOptions().isValid() | ||
| && (UInt256.fromHexString(configOptions.getCheckpointOptions().getTotalDifficulty().get()) | ||
| .greaterOrEqualThan(configOptions.getTerminalTotalDifficulty().get())); |
There was a problem hiding this comment.
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.
Added a test and another check for that case
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.
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.
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() { |
| .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.
Do we need a special case here as well for genesisTD = 0 = TTD?
There was a problem hiding this comment.
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-requiredlabel to this PR ifupdates are required.
Changelog