Frontrunning in Decentralized Exchanges, Miner Extractable Value, and Consensus Instability