-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Worldstate-only resync behavior #4875
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
Merged
garyschulte
merged 9 commits into
besu-eth:main
from
garyschulte:feature/bonsai-resync-ws
Jan 12, 2023
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3344dd3
initial stab at a light touch worldstate resync behavior
garyschulte fa57cac
added explicit worldstate clear to FastSyncDownloaderFactory
garyschulte d300685
explicitly clear worldstate for snap and checkpoint rather than relyi…
garyschulte 7c150f6
use debug rpc endpoint to resync worldstate
garyschulte 9f34c6b
reset sync status on worldstate resync, disable/enable transaction ha…
garyschulte 8d42daa
reset bad blocks manager on resync
garyschulte e891c69
TransactionPoolFactoryTest's and accessor for isEnabled()
garyschulte 19a7145
remove todo comment
garyschulte d830f2a
Reset transaction pool state every time the initial sync is done
fab-10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ava/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/DebugResyncWorldstate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright Hyperledger Besu Contributors. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations under the License. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods; | ||
|
|
||
| import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod; | ||
| import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; | ||
| import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; | ||
| import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; | ||
| import org.hyperledger.besu.ethereum.chain.Blockchain; | ||
| import org.hyperledger.besu.ethereum.core.Synchronizer; | ||
| import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; | ||
|
|
||
| public class DebugResyncWorldstate implements JsonRpcMethod { | ||
| private final Synchronizer synchronizer; | ||
| private final ProtocolSchedule protocolSchedule; | ||
| private final Blockchain blockchain; | ||
|
|
||
| public DebugResyncWorldstate( | ||
| final ProtocolSchedule protocolSchedule, | ||
| final Blockchain blockchain, | ||
| final Synchronizer synchronizer) { | ||
| this.synchronizer = synchronizer; | ||
| this.protocolSchedule = protocolSchedule; | ||
| this.blockchain = blockchain; | ||
| } | ||
|
|
||
| @Override | ||
| public String getName() { | ||
| return RpcMethod.DEBUG_RESYNC_WORLDSTATE.getMethodName(); | ||
| } | ||
|
|
||
| @Override | ||
| public JsonRpcResponse response(final JsonRpcRequestContext request) { | ||
| protocolSchedule | ||
| .getByBlockNumber(blockchain.getChainHeadBlockNumber()) | ||
| .getBadBlocksManager() | ||
| .reset(); | ||
| return new JsonRpcSuccessResponse( | ||
| request.getRequest().getId(), synchronizer.resyncWorldState()); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,12 @@ public void addBadBlock(final Block badBlock, final Optional<Throwable> cause) { | |
| } | ||
| } | ||
|
|
||
| public void reset() { | ||
| this.badBlocks.invalidateAll(); | ||
| this.badHeaders.invalidateAll(); | ||
| this.latestValidHashes.invalidateAll(); | ||
| } | ||
|
|
||
|
Comment on lines
+52
to
+57
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. Where is this called?
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. |
||
| /** | ||
| * Return all invalid blocks | ||
| * | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.