This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Start block state creation early #6167
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7c8061d
Use weak_ptr so if future get never called does not prevent destruction
heifner 83af362
Add verify_signee() method that uses future if set
heifner 4d34a70
Delay block signee verififcation for light validation
heifner 1deb426
Rename trust to more descriptive skip_validate_signee
heifner 48a72c5
Split verify_signee into two methods to make is clearer purpose
heifner d430371
Cleanup from peer review comments
heifner 3649fab
Add block id to EOS_ASSERT message
heifner 42611d3
Remove unused block_signing_key_future
heifner d08bee3
Remove used verify_signee_future()
heifner 1c575b4
Add EOS_ASSERTs to add( block_state_ptr ) since now called externally
heifner e1db176
- push_block now takes a block_state future which is created by
heifner 3be1511
Update to use new push_block that takes a future
heifner 67a9df7
Update tests to use new push_block that takes a future
heifner 91c0baa
Remove no longer valid comment
heifner edf82ea
Undo code changes to minimize diff
heifner 8793bf3
Pass signed_block_ptr to apply_block (revert previous uneeded pass of…
heifner 7cea107
Add optional verify of previous exist to fork_db add( block_state_ptr )
heifner File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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.
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.
Calling
fork_database::add( block_state_ptr )
here instead of the originalfork_database::add( signed_block_ptr bool )
skips some checks that were done in the original version.create_block_state_future
replicates thosefork_database::add( signed_block_ptr, bool)
checks, but it does so at a different time (and therefore potentially with different state of the fork database) than the call tofork_db.add
here.One of the two necessary checks, checking for duplicate blocks, is already handled in
fork_database::add( block_state_ptr )
with the assertion thatinserted.second
is true.The other check that is necessary to again here (so it could be done in
fork_database::add( block_state_ptr )
) is to ensure that the block still links to an existing block in the fork database. Without that check, it is possible to add a block into the fork database that does not link. For example, a user ofcontroller
could in theory:create_block_state_future
on two different blocks A and B where both currently link to existing blocks in the fork database and where B builds off of the current head.push_block
with the future of block A which causes: a fork switch, LIB advancement, and purging of orphaned branches which may include the block that the block B builds off of.push_block
with the future of block B.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.
The current code does not have more than one
create_block_state_future
in play at a time. It is single threaded from producer pluginon_incoming_block
topush_block
. Thecreate_block_state_future
creation of block_state which includes digest, merkle, and signee verification can run at the same time asabort_block
but the rest of the order is all single threaded.Now if we updated the code so that more than one
create_block_state_future
could be in flight at a time then that could certainly be a problem. That would take some work as it does verify previous is in the fork_db. Could create a version ofcreate_block_state_future
that takes the previous block so that a whole chain of blocks could be processed at once and then verify in fork_db add that the previous is there. However, that would require changing net_plugin to receive more than one block at a time or queue up blocks which would increase latency which is what this is attempting to reduce.That said the extra check doesn't hurt and should be quick, so I'll go ahead and add it.