-
Notifications
You must be signed in to change notification settings - Fork 978
Stop adding bad proposed block to bad block manager #5082
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
gfukushima
merged 19 commits into
hyperledger:main
from
gfukushima:dont-report-proposed-bad-blocks
Feb 22, 2023
Merged
Changes from 12 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
702c4c6
Add flag to distinguish when bad block is a proposed block
gfukushima 37f7559
Add flag to distinguish when bad block is a proposed block
gfukushima 56e584c
javadoc
gfukushima 65eedd4
Add shouldRecordBadBlock flag to stop adding proposed bad blocks to t…
gfukushima 461c4ca
Add overload to validateAndProcessBlock with shouldRecordBadBlock flag
gfukushima 78e0865
Add unit test to ensure flag is being used to add blocks to bad block…
gfukushima 72be1d8
Add unit test to ensure we don't add our own proposed bad block to th…
gfukushima c1a8bb9
Merge branch 'main' into dont-report-proposed-bad-blocks
gfukushima de0af4a
Merge branch 'main' into dont-report-proposed-bad-blocks
gfukushima fc92cf6
Add debug log when badBlock is not added
gfukushima 2c952ce
Merge remote-tracking branch 'origin/dont-report-proposed-bad-blocks'…
gfukushima 504e81a
Undo change done in the first approach
gfukushima 45dd0bf
Improve log
gfukushima f2684ac
Improve test names
gfukushima 3c3b35e
Improve javadoc of validateProposedBlock method
gfukushima aa63b5c
Remove method from interface
gfukushima a888fe5
Change validateProposedBlock access modifier to private
gfukushima 71bffd5
Merge branch 'main' into dont-report-proposed-bad-blocks
gfukushima 8144787
Merge branch 'main' into dont-report-proposed-bad-blocks
gfukushima 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
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 |
|---|---|---|
|
|
@@ -317,6 +317,26 @@ public void exceptionDuringBuildingBlockShouldNotBeInvalid() | |
| verify(willThrow, never()).addBadBlock(any(), any()); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldNotRecordProposedBadBlockToBadBlockManager() | ||
|
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. Is there a test already to ensure that an invalid block we received does get added to the bad blocks? |
||
| throws ExecutionException, InterruptedException { | ||
| // set up invalid parent to simulate one of the many conditions that can cause a block | ||
| // validation to fail | ||
| final BlockHeader invalidParentHeader = new BlockHeaderTestFixture().buildHeader(); | ||
|
|
||
| blockCreationTask.get(); | ||
|
|
||
| coordinator.preparePayload( | ||
| invalidParentHeader, | ||
| System.currentTimeMillis() / 1000, | ||
| Bytes32.ZERO, | ||
| suggestedFeeRecipient, | ||
| Optional.empty()); | ||
|
|
||
| verify(badBlockManager, never()).addBadBlock(any(), any()); | ||
| assertThat(badBlockManager.getBadBlocks().size()).isEqualTo(0); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldContinueBuildingBlocksUntilFinalizeIsCalled() | ||
| throws InterruptedException, ExecutionException { | ||
|
|
||
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
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.