test InsufficientFlowOutputs revert and boundary#442
test InsufficientFlowOutputs revert and boundary#442thedavidmeister wants to merge 1 commit intomainfrom
Conversation
Pins the lower-bound guard that rejects flowOutputs < MIN_FLOW_SENTINELS returned by the deployer. Two tests: - Negative: any flowOutputs in [0, MIN_FLOW_SENTINELS) reverts with InsufficientFlowOutputs. - Boundary: flowOutputs == MIN_FLOW_SENTINELS is accepted (lowest valid). Mutation verified: inverting the check (`<` → `>=`) makes both tests fail; reverting passes. Closes #311 #321. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughThis PR adds test coverage for the ChangesFlow Construction Test Coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/src/concrete/Flow.construction.t.sol`:
- Around line 42-45: Add an explicit fuzz-run pin for the boundary test by
configuring the test to run a fixed number of fuzz iterations (e.g., 2048) so
the sweep is stable and reproducible; update the test harness or metadata for
the function testFlowConstructionAcceptsFlowOutputsAtMin to include the
forge-config / fuzz-runs directive (matching the pattern used in the revert
test), ensuring the test is executed with the pinned run count every time.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 35a821b2-2973-436d-b85a-7756f2d5038f
📒 Files selected for processing (1)
test/src/concrete/Flow.construction.t.sol
| /// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value. | ||
| /// Pinning this boundary against regression complements the negative | ||
| /// test above. | ||
| function testFlowConstructionAcceptsFlowOutputsAtMin( |
There was a problem hiding this comment.
Add explicit fuzz-run pin for the boundary test.
Line 45 introduces the boundary test, but unlike the revert test it does not pin fuzz runs. If the intent is the stated 2048-run boundary sweep, add an explicit forge-config line so this is stable and reproducible.
Suggested patch
/// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value.
/// Pinning this boundary against regression complements the negative
/// test above.
+ /// forge-config: default.fuzz.runs = 2048
function testFlowConstructionAcceptsFlowOutputsAtMin(📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value. | |
| /// Pinning this boundary against regression complements the negative | |
| /// test above. | |
| function testFlowConstructionAcceptsFlowOutputsAtMin( | |
| /// `flowOutputs == MIN_FLOW_SENTINELS` is the lowest accepted value. | |
| /// Pinning this boundary against regression complements the negative | |
| /// test above. | |
| /// forge-config: default.fuzz.runs = 2048 | |
| function testFlowConstructionAcceptsFlowOutputsAtMin( |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@test/src/concrete/Flow.construction.t.sol` around lines 42 - 45, Add an
explicit fuzz-run pin for the boundary test by configuring the test to run a
fixed number of fuzz iterations (e.g., 2048) so the sweep is stable and
reproducible; update the test harness or metadata for the function
testFlowConstructionAcceptsFlowOutputsAtMin to include the forge-config /
fuzz-runs directive (matching the pattern used in the revert test), ensuring the
test is executed with the pinned run count every time.
Summary
Pins the
flowInitguard that rejects deployer-returnedflowOutputs < MIN_FLOW_SENTINELS(= 3). Two tests:flowOutputsin[0, MIN_FLOW_SENTINELS)reverts withInsufficientFlowOutputs.flowOutputs == MIN_FLOW_SENTINELSis accepted (lowest valid value).Mutation verified: inverting the check (
<→>=) makes both tests fail; reverting passes.Closes #311 #321.
Test plan
testFlowConstructionRevertsOnInsufficientFlowOutputs— 100 fuzz runstestFlowConstructionAcceptsFlowOutputsAtMin— 2048 fuzz runsFlow.sol:206→ both tests fail🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes