Thanks for the detailed explanation with examples.
As @Arachnid explained on gitter, the “bytecode invariant” may not hold for contracts deployed with CREATE2
or even with CREATE
if one of its ancestors were deployed with CREATE2
.
Therefore, it’s going to be even more critical going forward that the security pattern leverages EXTCODEHASH
before interacting with other contracts.
So it sounds like the bottomline is that these concerns are not new, have been deliberated, no mitigations are necessary and what is needed is incorporating this guideline in the security best practises.
This is a very interesting idea.