diff --git a/.forge-snapshots/Increment counter number.snap b/.forge-snapshots/Increment counter number.snap new file mode 100644 index 0000000..1d3d6fb --- /dev/null +++ b/.forge-snapshots/Increment counter number.snap @@ -0,0 +1 @@ +26276 \ No newline at end of file diff --git a/.forge-snapshots/Set counter number.snap b/.forge-snapshots/Set counter number.snap new file mode 100644 index 0000000..7edaeb9 --- /dev/null +++ b/.forge-snapshots/Set counter number.snap @@ -0,0 +1 @@ +26507 \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 42c3cda..c471eba 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,5 +32,5 @@ jobs: - name: Run Forge tests run: | - forge test -vvv + rm .forge-snapshots/* && forge test --isolate -vvv id: test diff --git a/foundry.toml b/foundry.toml index baea3d3..71b68fe 100644 --- a/foundry.toml +++ b/foundry.toml @@ -8,6 +8,8 @@ via_ir = true solc = "0.8.23" verbosity = 2 ffi = true +fs_permissions = [{ access = "read-write", path = ".forge-snapshots"}, + { access = "read", path = "script/" }] remappings = [ "forge-std=lib/forge-std/src", @@ -15,9 +17,19 @@ remappings = [ "@openzeppelin/contracts-upgradeable=lib/openzeppelin-contracts-upgradeable/contracts" ] -[profile.intense.fuzz] +[profile.default.fuzz] +runs = 1000 + +[profile.pr.fuzz] runs = 10000 -max_test_rejects = 999999 + +[profile.ci.fuzz] +runs = 100000 + +[profile.debug] +via_ir = false +optimizer_runs = 200 +fuzz.runs = 100 [fmt] line_length = 160 diff --git a/lib/forge-std b/lib/forge-std index 2f11269..8948d45 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit 2f112697506eab12d433a65fdc31a639548fe365 +Subproject commit 8948d45d3d9022c508b83eb5d26fd3a7a93f2f32 diff --git a/test/Counter.t.sol b/test/Counter.t.sol index 12eb00d..a752cc1 100644 --- a/test/Counter.t.sol +++ b/test/Counter.t.sol @@ -3,6 +3,7 @@ pragma solidity 0.8.23; import "forge-std/Test.sol"; import "test/util/TestHelpers.sol"; +import {GasSnapshot} from "forge-gas-snapshot/GasSnapshot.sol"; import {Counter} from "src/Counter.sol"; @@ -15,18 +16,20 @@ abstract contract Deployed is Test, TestHelpers { } } -contract CounterTest_Deployed is Deployed { +contract CounterTest_Deployed is Deployed, GasSnapshot { function test_IsInitialized() public { assertEq(counter.number(), 10); } function test_IncrementsNumber() public { counter.increment(); + snapLastCall("Increment counter number"); assertEq(counter.number(), 11); } function testFuzz_SetsNumber(uint256 x) public { counter.setNumber(x); + snapLastCall("Set counter number"); assertEq(counter.number(), x); } }