forked from vmware/concord-bft
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix order of block deletes relative to adds on ST (vmware#1955)
Given healthy replicas execute pruning (block deletes) and block additions in a specified order, e.g.: "block(1, 1), block(2, 1), block(3, 1), prune 1, prune 2, block(4, 3)" where block(X, Y) means block X being added when current genesis is Y and prune N means prune block N, we want that a fallen-behind or crashed replica executes them in the same order on top of its blockchain. This is required so that all replicas reach to the same hash commitments at the end. Currently, the replica that receives blocks from ST will do the following: 1. Add all blocks to its chain. 2. Prune up to the same point as other replicas. However, this would lead to the following different order: "block(1, 1), block(2, 1), block(3, 1), block(4, 1), prune 1, prune 2" In order to provide the same order, we persist the genesis block ID at the time any subsequent block is added in that block. That allows us to then iterate over blocks received by ST and before adding them to the local blockchain, we first prune up to the genesis block ID in the ST block currently being processed. For example, if block 1 is already existing at the crashed replica, its actions would be: 1. block(2, 1) -> add block 2 2. block(3, 1) -> add block 3 3. block(4, 3): * prune block1 and 2 (up to 3) * add block 4 as block (4, 3) Above solution adds a single 8-byte "concord_internal" category key-value in every block. Remove `last_scheduled_block_for_pruning_` in PruningHandler and just use the genesis block ID for pruning status. Change unit tests so that they accommodate the new key. Introduce a new unit test that tests the new behaviour. Update the `test_pruning_command_with_failures` reconfiguration test so that it always does ST and add an extra step - a subsequent ST after pruning.
- Loading branch information
1 parent
8ece3b1
commit 119b374
Showing
11 changed files
with
450 additions
and
120 deletions.
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
Oops, something went wrong.