When a full node receives a freshly mined new block, it seems straightfoward how we could validate all the transactions contained in the block. As we already the current world state, we could just apply all the Txs in the new block and check the resulting stateRoot against the state root from the new block. If it's identical, then we are sure the new block is valid(assume the pow part is okay)
Understanding that it is also trivial to check the inclusion/exclusion of a particular transaction, how can we check if a transaction included in a old block is valid?
I'm asking because it seems for validating old transactions, we don't have access to old world state then(only stateRoot, unless we took additonal snapshot, but that's not really the Ethereum default behavior?)
EDIT: Understanding that Ethereum is always making sure that the current state & coming transactions are valid(which is doable as mentioned above), what I am asking is more relevant to Ethereum-based sidechains (or more specifically, Generalized Plasma Sidechains).
So we may need to validate a relatively old transactions in future, when the world state has already been mutated. I want to understand if it is necessary to keep a lot of world state full snapshots in order to achieve this. Or would stateRoot suffice?
geth
does keep old states around. (That's howeth_call
andeth_getStorageAt
can give answers for old blocks.)