-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vochain: order transactions when creating new blocks (#1121)
refactor Vocdoni's Interaction with CometBFT 1. Implement transaction ordering during block creation. 2. Ensure blocks do not store invalid transactions. 3. Introduce mempool TTL mechanism and max attempts protection. 4. Implement Optimistic Execution for validators. 5. Resolve an app hash bug during block construction. **Transaction Ordering** - Transactions are sorted by nonce for the same sender during the "Prepare proposal" phase of CometBFT callbacks. **Block Transaction Validation** - A temporary state is constructed to execute proposal transactions, leading to hard-checks against this state. This eliminates the need for the previous soft-check approach. - `ProcessProposal` will return REJECT if any transaction in the block proposal is invalid. **Mempool Enhancements** - Transactions will be removed from the mempool after a set duration (TTL). - After three unsuccessful attempts to include a transaction in a block, it will be removed from the mempool. **Optimistic Execution** - If a block is executed during `ProcessProposal` by a validator and is accepted, its state is retained and not rolled back. - During `FinalizeBlock`, the system checks if the block was previously executed. If it was, there's no need for re-execution, potentially speeding up block production. **Block Construction Bug** - An issue was identified where the app hash reported by `FinalizeBlock` was incorrectly computed. - Due to the new CometBFT callback structure, block execution and hash return are separated from saving to persistent storage. - The previous `State.Save()` was incompatible with this two-step process. It has been modified to now include `PrepareCommit()` and `Commit()` functions. --- Signed-off-by: p4u <[email protected]>
- Loading branch information
Showing
42 changed files
with
1,202 additions
and
550 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
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.