Skip to content

Commit 2b197e3

Browse files
committed
feat(10027-cheatcode-mutability-tags): getrecordedlogs and getwallets are external view
1 parent 4c73eaf commit 2b197e3

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

crates/cheatcodes/assets/cheatcodes.json

Lines changed: 4 additions & 4 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ interface Vm {
909909

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

914914
// -------- Gas Metering --------
915915

@@ -2244,7 +2244,7 @@ interface Vm {
22442244

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

22492249
// ======== Utilities ========
22502250

crates/forge/tests/cli/script.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ forgetest_init!(can_get_script_wallets, |prj, cmd| {
22592259
import "forge-std/Script.sol";
22602260
22612261
interface Vm {
2262-
function getWallets() external returns (address[] memory wallets);
2262+
function getWallets() external view returns (address[] memory wallets);
22632263
}
22642264
22652265
contract WalletScript is Script {
@@ -2576,13 +2576,13 @@ Chain 31337
25762576
accessList []
25772577
chainId 31337
25782578
gasLimit 228247
2579-
gasPrice
2579+
gasPrice
25802580
input [..]
2581-
maxFeePerBlobGas
2582-
maxFeePerGas
2583-
maxPriorityFeePerGas
2581+
maxFeePerBlobGas
2582+
maxFeePerGas
2583+
maxPriorityFeePerGas
25842584
nonce 0
2585-
to
2585+
to
25862586
type 0
25872587
value 0
25882588
@@ -2591,11 +2591,11 @@ value 0
25912591
accessList []
25922592
chainId 31337
25932593
gasLimit 93856
2594-
gasPrice
2594+
gasPrice
25952595
input 0x7357f5d2000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000000000000000000000000000000000000001c8
2596-
maxFeePerBlobGas
2597-
maxFeePerGas
2598-
maxPriorityFeePerGas
2596+
maxFeePerBlobGas
2597+
maxFeePerGas
2598+
maxPriorityFeePerGas
25992599
nonce 1
26002600
to 0x5FbDB2315678afecb367f032d93F642f64180aa3
26012601
type 0

docs/dev/cheatcode-mutability-review.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Mark `view`:
4747
- [x] `getMappingLength`: `getMappingLength(address,bytes32)` _suggested: `view`_
4848
- [x] `getMappingSlotAt`: `getMappingSlotAt(address,bytes32,uint256)` _suggested: `view`_
4949
- [ ] `getNonce_1`: `getNonce(address,uint256,uint256,uint256)`
50-
- [ ] `getRecordedLogs`: `getRecordedLogs()`
51-
- [ ] `getWallets`: `getWallets()`
50+
- [x] `getRecordedLogs`: `getRecordedLogs()` _suggested: `view`_
51+
- [x] `getWallets`: `getWallets()` _suggested: `view`_
5252
- [x] `noAccessList`: `noAccessList()` _suggested: `view`_
5353
- [x] `readCallers`: `readCallers()` _suggested: `view`_
5454

0 commit comments

Comments
 (0)