Detecting and quantifying spam transactions on Polygon

I have seen some evidence of tons of spam transactions being a dominant strategy on L2s due to their increased throughput and lower transaction fees.
------------------------------------------------------------------------------------------------------------- @0xjepsen

It is a common practice on L2s, and in particular on Polygon to spam MEV transactions in a probabilistic way to extract MEV. How can one automatically detect such a transaction? What percentage of transactions do they represent? How has it changed over time?

These are questions that deserve answers as they:

  1. allow to better understand MEV on Polygon
  2. are a good indicator of the quality of the network

Indeed, most of these transactions revert or finish early and don’t do anything. They unnecessarily take up space and delay other users’ transactions. This is a known problem but has never been addressed as no one ever properly worked on identifying and quantifying such transactions.

Such an example of transaction is: