Skip to content

Commit 97bb885

Browse files
committed
feat(10027-cheatcode-mutability-tags): make eth_getLogs getMappingLength getMappingSlotAt view
1 parent 1daac99 commit 97bb885

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

crates/cheatcodes/assets/cheatcodes.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cheatcodes/spec/src/vm.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,17 +436,18 @@ interface Vm {
436436

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

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

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

452453
// -------- Block and Transaction Properties --------
@@ -866,6 +867,7 @@ interface Vm {
866867
#[cheatcode(group = Evm, safety = Safe)]
867868
function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] calldata topics)
868869
external
870+
view
869871
returns (EthGetLogs[] memory logs);
870872

871873
// --- Behavior ---

docs/dev/cheatcode-mutability-review.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ Mark `view`:
4242

4343
- [x] `accessList`: `accessList(address,bytes32[])` _resolved: not view, keep as is due to test coverage indicating stateful behavior_
4444
- [x] `accesses`: `accesses(address)` _suggested: `view`_
45-
- [ ] `eth_getLogs`: `eth_getLogs(uint256,uint256,address,bytes32[])`
45+
- [x] `eth_getLogs`: `eth_getLogs(uint256,uint256,address,bytes32[])` _suggested: `view`_
4646
- [ ] `getMappingKeyAndParentOf`: `getMappingKeyAndParentOf(address,bytes32)`
47-
- [ ] `getMappingLength`: `getMappingLength(address,bytes32)`
48-
- [ ] `getMappingSlotAt`: `getMappingSlotAt(address,bytes32,uint256)`
47+
- [x] `getMappingLength`: `getMappingLength(address,bytes32)` _suggested: `view`_
48+
- [x] `getMappingSlotAt`: `getMappingSlotAt(address,bytes32,uint256)` _suggested: `view`_
4949
- [ ] `getNonce_1`: `getNonce(address,uint256,uint256,uint256)`
5050
- [ ] `getRecordedLogs`: `getRecordedLogs()`
5151
- [ ] `getWallets`: `getWallets()`

0 commit comments

Comments
 (0)