foundry
foundry copied to clipboard
chisel injection into test function
Component
Chisel
Describe the feature you would like
This feature would introduce the possibility to add a call such as vm.chisel()
or vm.chiselBreakpoint()
anywhere in a test function.
The desired behavior is that calling chisel
on that function will result in the session being loaded with the entire state of the test at the time the call was made, including the storage state as well as the memory.
Running forge test
should not result in a different behavior than usual.
Example
pragma solidity ^0.8.15;
import "forge-std/Test.sol";
import "forge-std/console.sol";
import "src/Kevin.sol";
contract KevinTest is Test {
Kevin public kevin;
function setUp() public {
kevin = new Kevin();
}
function testKevin() public {
uint256 bob = 15;
vm.chisel();
uint256 stewart = 1;
}
}
Followed by chisel --match testKevin
, which opens up a chisel session.
➜ address(kevin)
Type: address
└ Data: 0xf4d9599afd90b5038b18e3b551bc21a97ed21c37
➜ bob
Type: uint
├ Hex: 0xf
└ Decimal: 15
➜ stewart
Compiler errors:
error[7576]: DeclarationError: Undeclared identifier.
--> ReplContract.sol:18:1:
|
18 | stewart;
| ^^^^^^^
➜
Additional context
No response