foundry-rs / foundry-rs/foundry

feat(cheatcodes): add `vm.storeTransient` and `vm.loadTransient`

Open
#8,165 4 comments 1 reaction 0 assignees View on GitHub
A-cheatcodes T-feature T-to-discuss
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
16h 38m
Merged PRs (30d)
511

Description

### Component

Forge

### Describe the feature you would like

A cheatcode that sets a contract's transient storage slot to a particular value, and another one allowing to read it

### Additional context

It'd be consistent to have methods to read/write transient storage similar to those that already perform those operations on regular storage

They are useful for mocks & unit testing of contracts using transient storage, and would be extra useful given there are currently no solidity variables of `transient` type and that makes it more cumbersome to write mocks by hand or with automated mocking tools such as [smock-foundry](https://github.com/defi-wonderland/smock-foundry)

Setting the transient storage slot from outside the contract enables devs to do less mocking

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.