When you call pure and view functions, they only run on the node you use to connect to the network. This makes sense, because no state needs to be changed.
But for transactions that end up failing or reverting - shouldn't your node be able to tell and not propagate it to the entire network and waste gas? What makes it more confusing is that sometimes transactions do fail and don't cost you any gas, whereas other times you lose a hefty gas fee.
I know that assert
uses up all the gas, and require
/revert
only use up some gas, but why do any of them use up any gas at all?
And when you send ETH to a contract that doesn't have receive/fallback, that transaction actually goes onchain but fails, and you lose the transaction fee. I feel like something this simple shouldn't be propagated to the network and waste gas.
Thank you.