I was wondering why smart contracts have to be deterministic. As I understand it, to deploy a smart contract you just send it as the payload of a transaction without specifying a recipient. It's then compiled to bytecode to be run on the EVM. All miners have some dataset derived from the full chain (down to the genesis block) which they use as the basis to solve some complex math problem that can only be done through brute force. The miner that solves this problem gets the block reward (until ETH switches to PoS).
I don't understand why consensus can't be reached if the contract is non-deterministic. Does it have to do with the way that transactions generated by the contract are validated and not the validation of the contract itself? Thanks.