Closed NoahZinsmeister closed 1 year ago
ah thanks, fixed in 63a504e03a4300b297b603afff432396e97710e8
Got this error but don't understand why - both readLine and _getSnapFile are views. Had to remove the view modifier _checkSnapshot and _readSnapshot.
➜ cctp-money-bridge-contracts (audit-pass-3) ✗ forge test --use 0.8.22 --evm-version paris
[⠊] Compiling...
[⠰] Compiling 3 files with 0.8.22
[⠔] Solc 0.8.22 finished in 335.68ms
Error:
Compiler run failed:
Error (8961): Function cannot be declared as view because this expression (potentially) modifies the state.
--> lib/forge-gas-snapshot/src/GasSnapshot.sol:118:34:
|
118 | string memory oldValue = vm.readLine(_getSnapFile(name));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@marktoda
interesting, could be that you're not using the right Test
mixin from foundry, for ex it works on latest in v4 with https://github.com/Uniswap/v4-core/blob/83557113a0425eb3d81570c30e7a5ce550037149/test/PoolManager.t.sol#L4
or check in your forge-std Script.sol to see how it defines readLine - in my local instances it is function readLine(string calldata path) external view returns (string memory line);
running
forge install
in a repo withforge-gas-snapshot
as a dependency results in a compiler warning on this line: https://github.com/marktoda/forge-gas-snapshot/blob/74afc91f5e52bd402811c66168c56a011c21def9/src/GasSnapshot.sol#L117