snarkOS icon indicating copy to clipboard operation
snarkOS copied to clipboard

Process unconfirmed_transactions by priority_fee and oldest timestamp

Open vicsn opened this issue 1 year ago • 0 comments

Motivation

Following EIP-1559 and common decency, this PR ensures we process transactions by priority_fee. If the priority_fee is the same, we order by timestamp (in nanoseconds), and otherwise randomly by transaction_id.

It may be narrowly individually rational for validators to only sort by priority_fee and ignore the timestamp/id, but "It is recommended that transactions with the same priority fee be sorted by time the transaction was received" - https://eips.ethereum.org/EIPS/eip-1559 . This improves the performance and security of the whole network, which also matters for validators.

Test Plan

Separated the queue insertion and popping functions so they can be tested.

vicsn avatar Jan 08 '24 12:01 vicsn