Closed norswap closed 2 years ago
For reference, the bug was introduced here: https://github.com/ethereum-optimism/cannon/pull/6
Proof of concept script demonstrating the bug: https://gist.github.com/norswap/59db880262f314e529f437263640a1a5
The diagnostic of the problem is wrong, explanation here: https://github.com/ethereum-optimism/minigeth/pull/1#issuecomment-1130035711
This is the bug that was surfaced by the Cannon bug bounty.
The issue is that we can't fetch the preimage for hashes that are "intermediate" Merkle root nodes. These are Merkle root nodes that are transient during block execution. They appear neither in the Merkle root before the state transition (previous block's state root) nor in the Merkle root after it (current block state's root).
Proposed solution: introduce a caching layer for the preimage oracle, and write newly created Merkle nodes’ preimages to this caching layer.
We should also introduce a regression test for this, in the form of some unit tests for the trie module. Maybe we can reuse the Geth unit tests (cf. https://github.com/ethereum-optimism/cannon/issues/84).