Commit 8917511b authored by smartcontracts's avatar smartcontracts Committed by GitHub

feat(ci): use foundry profiles to set fuzz parameters (#12346)

Updates contracts-bedrock-tests to use foundry profiles to set the
fuzz/invariant run parameters instead of inlining it. Has the
added benefit of separating out into two profiles so that tests
can be selectively tuned down for the heavy fuzz pipeline without
also tuning them down for the standard CI pipeline.
parent 5a155eef
...@@ -616,6 +616,10 @@ jobs: ...@@ -616,6 +616,10 @@ jobs:
description: Timeout for running tests description: Timeout for running tests
type: string type: string
default: 15m default: 15m
test_profile:
description: Profile to use for testing
type: string
default: ci
parallelism: <<parameters.test_parallelism>> parallelism: <<parameters.test_parallelism>>
steps: steps:
- checkout - checkout
...@@ -663,11 +667,9 @@ jobs: ...@@ -663,11 +667,9 @@ jobs:
TEST_FILES=$(echo "$TEST_FILES" | circleci tests split --split-by=timings) TEST_FILES=$(echo "$TEST_FILES" | circleci tests split --split-by=timings)
TEST_FILES=$(echo "$TEST_FILES" | sed 's|^test/||') TEST_FILES=$(echo "$TEST_FILES" | sed 's|^test/||')
MATCH_PATH="./test/{$(echo "$TEST_FILES" | paste -sd "," -)}" MATCH_PATH="./test/{$(echo "$TEST_FILES" | paste -sd "," -)}"
export FOUNDRY_INVARIANT_RUNS=<<parameters.test_invariant_runs>> forge test --match-path "$MATCH_PATH"
export FOUNDRY_INVARIANT_DEPTH=<<parameters.test_invariant_depth>>
forge test --fuzz-runs <<parameters.test_fuzz_runs>> --match-path "$MATCH_PATH"
environment: environment:
FOUNDRY_PROFILE: ci FOUNDRY_PROFILE: <<parameters.test_profile>>
working_directory: packages/contracts-bedrock working_directory: packages/contracts-bedrock
no_output_timeout: <<parameters.test_timeout>> no_output_timeout: <<parameters.test_timeout>>
- run: - run:
...@@ -1407,9 +1409,7 @@ workflows: ...@@ -1407,9 +1409,7 @@ workflows:
test_parallelism: 1 test_parallelism: 1
test_list: git diff origin/develop...HEAD --name-only -- './test/**/*.t.sol' | sed 's|packages/contracts-bedrock/||' test_list: git diff origin/develop...HEAD --name-only -- './test/**/*.t.sol' | sed 's|packages/contracts-bedrock/||'
test_timeout: 1h test_timeout: 1h
test_fuzz_runs: 10000 test_profile: ciheavy
test_invariant_runs: 128
test_invariant_depth: 512
- contracts-bedrock-coverage - contracts-bedrock-coverage
- contracts-bedrock-checks: - contracts-bedrock-checks:
requires: requires:
......
...@@ -74,6 +74,13 @@ fuzz = { runs = 512 } ...@@ -74,6 +74,13 @@ fuzz = { runs = 512 }
runs = 256 runs = 256
depth = 32 depth = 32
[profile.ciheavy]
fuzz = { runs = 10000 }
[profile.ciheavy.invariant]
runs = 128
depth = 512
################################################################ ################################################################
# PROFILE: LITE # # PROFILE: LITE #
################################################################ ################################################################
......
...@@ -22,7 +22,7 @@ contract DeployVariations_Test is CommonTest { ...@@ -22,7 +22,7 @@ contract DeployVariations_Test is CommonTest {
} }
} }
/// forge-config: ci.fuzz.runs = 512 /// forge-config: ciheavy.fuzz.runs = 512
/// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs with any mix of CGT and Alt-DA.
function testFuzz_enableFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { function testFuzz_enableFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual {
enableAddOns(_enableCGT, _enableAltDa); enableAddOns(_enableCGT, _enableAltDa);
...@@ -30,7 +30,7 @@ contract DeployVariations_Test is CommonTest { ...@@ -30,7 +30,7 @@ contract DeployVariations_Test is CommonTest {
super.setUp(); super.setUp();
} }
/// forge-config: ci.fuzz.runs = 512 /// forge-config: ciheavy.fuzz.runs = 512
/// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA. /// @dev It should be possible to enable Fault Proofs and Interop with any mix of CGT and Alt-DA.
function test_enableInteropAndFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual { function test_enableInteropAndFaultProofs(bool _enableCGT, bool _enableAltDa) public virtual {
enableAddOns(_enableCGT, _enableAltDa); enableAddOns(_enableCGT, _enableAltDa);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment