Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b2ff5b1
chore(10027-cheatcode-mutability-tags): create checklist for cheatcod…
Mouzayan Apr 23, 2025
a4e93e0
chore(10027-cheatcode-mutability-tags): review 231 external cheatcode…
Mouzayan Apr 23, 2025
b240cf4
chore(10027-cheatcode-mutability-tags): mark contains(string,string) …
Mouzayan Apr 23, 2025
fbc2663
chore(10027-cheatcode-mutability-tags): keep accesslist as is due to …
Mouzayan Apr 24, 2025
da22c45
chore(10027-cheatcode-mutability-tags): accesses() confirmed to not h…
Mouzayan Apr 24, 2025
4a278e0
feat(10027-cheatcode-mutability-tags): make eth_getLogs getMappingLen…
Mouzayan Apr 25, 2025
a2dc418
feat(10027-cheatcode-mutability-tags): mark getMappingKeyAndParentOf …
Mouzayan Apr 25, 2025
d67e375
feat(10027-cheatcode-mutability-tags): noaccesslist and readcallers a…
Mouzayan Apr 26, 2025
6d72bbb
feat(10027-cheatcode-mutability-tags): getrecordedlogs and getwallets…
Mouzayan Apr 26, 2025
8c5473b
feat(10027-cheatcode-mutability-tags): getNonce_1 is external view
Mouzayan Apr 26, 2025
1232b10
feat(10027-cheatcode-mutability-tags): remove cheatcode-mutability-re…
Mouzayan May 6, 2025
7c1d0ab
feat(10027-cheatcode-mutability-tags): add back white space
Mouzayan May 6, 2025
8ec5aaa
feat(10027-cheatcode-mutability-tags): regenerate Vm.sol with updated…
Mouzayan May 7, 2025
6c03eb7
Merge branch 'master' into chore-10027-cheatcode-mutability-tags
onbjerg Aug 25, 2025
ba90336
do not mark noAccessList as view as it clears state and is stateful
zerosnacks Aug 26, 2025
69adbcb
Merge branch 'master' into chore-10027-cheatcode-mutability-tags
zerosnacks Aug 26, 2025
4a4a6ab
fix tests
zerosnacks Aug 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions crates/cheatcodes/assets/cheatcodes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions crates/cheatcodes/spec/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ interface Vm {

/// Get the nonce of a `Wallet`.
#[cheatcode(group = Evm, safety = Safe)]
function getNonce(Wallet calldata wallet) external returns (uint64 nonce);
function getNonce(Wallet calldata wallet) external view returns (uint64 nonce);

/// Loads a storage slot from an address.
#[cheatcode(group = Evm, safety = Safe)]
Expand Down Expand Up @@ -413,7 +413,7 @@ interface Vm {

/// Gets all accessed reads and write slot from a `vm.record` session, for a given address.
#[cheatcode(group = Evm, safety = Safe)]
function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);
function accesses(address target) external view returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);

/// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order,
/// along with the context of the calls
Expand Down Expand Up @@ -448,17 +448,18 @@ interface Vm {

/// Gets the number of elements in the mapping at the given slot, for a given address.
#[cheatcode(group = Evm, safety = Safe)]
function getMappingLength(address target, bytes32 mappingSlot) external returns (uint256 length);
function getMappingLength(address target, bytes32 mappingSlot) external view returns (uint256 length);

/// Gets the elements at index idx of the mapping at the given slot, for a given address. The
/// index must be less than the length of the mapping (i.e. the number of keys in the mapping).
#[cheatcode(group = Evm, safety = Safe)]
function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external returns (bytes32 value);
function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external view returns (bytes32 value);

/// Gets the map key and parent of a mapping at a given slot, for a given address.
#[cheatcode(group = Evm, safety = Safe)]
function getMappingKeyAndParentOf(address target, bytes32 elementSlot)
external
view
returns (bool found, bytes32 key, bytes32 parent);

// -------- Block and Transaction Properties --------
Expand Down Expand Up @@ -718,7 +719,7 @@ interface Vm {

/// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.
#[cheatcode(group = Evm, safety = Unsafe)]
function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);
function readCallers() external view returns (CallerMode callerMode, address msgSender, address txOrigin);

// ----- Arbitrary Snapshots -----

Expand Down Expand Up @@ -890,6 +891,7 @@ interface Vm {
#[cheatcode(group = Evm, safety = Safe)]
function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics)
external
view
returns (EthGetLogs[] memory logs);

// --- Behavior ---
Expand Down Expand Up @@ -931,7 +933,7 @@ interface Vm {

/// Gets all the recorded logs.
#[cheatcode(group = Evm, safety = Safe)]
function getRecordedLogs() external returns (Log[] memory logs);
function getRecordedLogs() external view returns (Log[] memory logs);

// -------- Gas Metering --------

Expand Down Expand Up @@ -2281,7 +2283,7 @@ interface Vm {

/// Returns addresses of available unlocked wallets in the script environment.
#[cheatcode(group = Scripting)]
function getWallets() external returns (address[] memory wallets);
function getWallets() external view returns (address[] memory wallets);

// ======== Utilities ========

Expand Down Expand Up @@ -2347,7 +2349,7 @@ interface Vm {
function indexOf(string calldata input, string calldata key) external pure returns (uint256);
/// Returns true if `search` is found in `subject`, false otherwise.
#[cheatcode(group = String)]
function contains(string calldata subject, string calldata search) external returns (bool result);
function contains(string calldata subject, string calldata search) external pure returns (bool result);

// ======== JSON Parsing and Manipulation ========

Expand Down
2 changes: 1 addition & 1 deletion crates/forge/tests/cli/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2296,7 +2296,7 @@ forgetest_init!(can_get_script_wallets, |prj, cmd| {
import "forge-std/Script.sol";

interface Vm {
function getWallets() external returns (address[] memory wallets);
function getWallets() external view returns (address[] memory wallets);
}

contract WalletScript is Script {
Expand Down
20 changes: 10 additions & 10 deletions testdata/cheats/Vm.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading