foundry
foundry copied to clipboard
Cheatcode for cloning account to a specific address
Component
Forge
Describe the feature you would like
We are interested in a new cheatcode op: vm.cloneAccount, which clones (code, state, balance, nonce) from one account to another account. This would be useful when we need to deploy code with a complex constructor to a specific address, let external calls from a contract we cannot control execute different code on different accounts when we fork the chain, etc. These cannot be easily achieved using vm.deal, vm.etch or vm.accesses
This operation is hard to implement in Solidity but easy in revm.
Example:
vm.cloneAccount(0x35c9dfd76bf02107ff4f7128Bd69716612d31dDb, 0xeCf9571038d92097a6C09A8d75713fEE69877211)
which should clone (code, state, balance, nonce) of 0x35c9dfd76bf02107ff4f7128Bd69716612d31dDb to 0xeCf9571038d92097a6C09A8d75713fEE69877211.
Additional context
No response
i can take this up if no objection on getting this into cheatcodes
This seems useful to me, @mattsse any objections here?
I don't see why not
@shouc if you would still like to implement this, we have improved cheatcodes DX a lot, check out the cheatcodes dev docs
@shouc Hi, are you still working on this feature?