-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sequencer)!: enforce block ordering by transaction group (#1618)
## Summary We want to order blocks by the transaction categories introduced in #1512 to finish the goals of #1412. ## Background Certain transactions have the ability to cause other transactions to become invalid. For example, `FeeChangeActions` can cause transactions that were valid to become invalid. For the sake of UX we want to order the potentially-invalidating actions after others so we don't needlessly execute transactions that were just invalidated. More background can be found in #1412. ## Changes - The mempool now orders the transactions it feeds to `prepare_proposal` by `ActionGroup`. - `prepare_proposal` will now skip any transactions in it's block construction process that are out of group order. - `process_proposal` will now reject any blocks that contain out-of-order transactions. Note: the mempool does not check for out of order actions inside of the pending queue. This was decided because the amount of times that actions besides `BundleableGeneral` are expected to be ran is low. Instead we let `prepare_proposal` gracefully ignore out-of-order actions in a way that allows them to be included in future blocks. For example, let's say an account sends these two transactions into the mempool: - `tx_0: {nonce: 0, action_group: UnbundleableGeneral}` - `tx_1: {nonce: 1, action_group: BundleableGeneral}` The mempool will feed these transaction in the order of `{tx_1, tx_0}` to `prepare_proposal`, which is correct on a group ordering level but incorrect on a nonce ordering level. `prepare_proposal` will handle this by skipping `tx_1` and only including `tx_0` in the block. The mempool will re-feed `tx_1` on the next round to `prepare_proposal` to be included. ## Testing Unit tests and ran locally. ## Breaking Changelist Block that would've passed before with incorrect transaction ordering will now fail. ## Related Issues closes #1412 #1417
- Loading branch information
Showing
10 changed files
with
799 additions
and
152 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,8 @@ use crate::{ | |
Protobuf, | ||
}; | ||
|
||
pub mod group; | ||
|
||
#[derive(Clone, Debug)] | ||
#[cfg_attr( | ||
feature = "serde", | ||
|
Oops, something went wrong.