Ganache has recently introduced the ability to fork from a live blockchain at a particular block number. https://github.com/trufflesuite/ganache/releases/tag/v7.0.0
After forking, I would like to be able to modify the smart contract code of an existing contract in order to test what happens with different versions of this contract in the current state of the blockchain. An obvious example why I might do this is to add in some events to the contract that aren't already there and then trace those events for debugging purposes.
Is this possible in any way?
Of course, you can't normally modify code after contract deployment. But since this is a local blockchain, I was hoping there would be a way of breaking the rules and force some new code in?
Most importantly, I can't deploy a new contract because I want to have access to this contract's storage, and also, performing this extra transaction will interfere with the block number, and I intend to do some simulations from the exact block number at fork-time.
I want to be able to do this with arbitrary contracts, so I won't have control over the original contract code deployed to the real blockchain. And so my only opinion is to forcefully modify the code after forking.