-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Build blocks using txs with higher fee first (#11093)
Updates the tx pool to store pending tx hashes sorted by fee. We use the sum of the l2 and da priority fees for this. Fixes #11084
- Loading branch information
1 parent
8105d37
commit def7cd7
Showing
6 changed files
with
102 additions
and
47 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { type Tx } from '@aztec/circuit-types'; | ||
import { Buffer32 } from '@aztec/foundation/buffer'; | ||
|
||
/** | ||
* Returns a string representing the priority of a tx. | ||
* Txs with a higher priority value are returned first when retrieving pending tx hashes. | ||
* We currently use the sum of the priority fees for the tx for this value, represented as hex. | ||
*/ | ||
export function getPendingTxPriority(tx: Tx): string { | ||
const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas; | ||
const totalFees = priorityFees.feePerDaGas.toBigInt() + priorityFees.feePerL2Gas.toBigInt(); | ||
return Buffer32.fromBigInt(totalFees).toString(); | ||
} |
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