What Determines the Order of Transactions Selected from the Mempool?
The primary factor determining the order of transactions selected from the public mempool by a validator is the transaction fee, commonly known as the gas fee. Validators are profit-driven and prioritize transactions that offer the highest fee per unit of gas used.
This "priority gas auction" system is what enables front-running: a malicious actor simply pays a higher gas fee than the target transaction to ensure their trade is included and executed first. Other factors, like the transaction's time of submission, are secondary.