foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat: add `vm.clearTransient`

Open andreas-blockswap opened this issue 1 year ago • 8 comments

Component

Forge

Describe the feature you would like

In solc version 0.8.24, transactions compose differently than message calls. While adding support for solc 0.8.24 (issue #6903) I think that it will be useful with a cheat code to clear the transient storage, so that we can model transactions with message calls.

For example a cheat code function clearTransientStorage(address) to zero the transient storage. This cheat code can be used to model a transaction a.f(x) with

vm.clearTransientStorage(address(a));
a.f(x);
vm.clearTransientStorage(address(a));

and transaction composition of a.f(x) and a.g(y) can be modeled with

vm.clearTransientStorage(address(a));
a.f(x);
vm.clearTransientStorage(address(a));
a.g(y);
vm.clearTransientStorage(address(a));

Additional context

No response

andreas-blockswap avatar Jan 26 '24 14:01 andreas-blockswap