Skip to content

test Flow.flow nonReentrant guard via malicious token callback#446

Open
thedavidmeister wants to merge 1 commit intomainfrom
2026-05-05-issue-324-330-reentrancy-guard-test
Open

test Flow.flow nonReentrant guard via malicious token callback#446
thedavidmeister wants to merge 1 commit intomainfrom
2026-05-05-issue-324-330-reentrancy-guard-test

Conversation

@thedavidmeister
Copy link
Copy Markdown
Contributor

Summary

Pins Flow.flow's nonReentrant guard. New test deploys a MaliciousReenteringToken whose transferFrom re-enters flow.flow(...) on the same flow contract and asserts the inner call reverts with the OZ ReentrancyGuardUpgradeable v4 string "ReentrancyGuard: reentrant call".

Mutation verified: dropping nonReentrant from Flow.flow makes the inner call succeed and the outer test fails (reverting with UnsupportedERC20Flow from a later branch instead of the reentrancy revert); reverting passes.

The malicious token contract lives in test/concrete/ per the project rule that test helper contracts are not inlined in test files.

This PR also resolves the empirical observation in #330 (Pass 5 mutation showed nonReentrant removal was uncaught by any test) by adding the test that catches it.

Closes #324 #330.

Test plan

  • testFlowReentrancyGuardFiresOnTokenCallback — 100 fuzz runs
  • mutation: drop nonReentrant from Flow.flow → test fails

🤖 Generated with Claude Code

`Flow.flow` carries `nonReentrant`. A new test deploys a
`MaliciousReenteringToken` whose `transferFrom` re-enters
`flow.flow(...)` on the same flow contract and asserts that the inner
call reverts with the OZ ReentrancyGuardUpgradeable v4 string
("ReentrancyGuard: reentrant call").

Mutation verified: dropping `nonReentrant` from `Flow.flow` makes the
inner call succeed and the outer test fail; reverting passes.

The malicious token contract lives in test/concrete/ per project rule
that test helper contracts are not inlined in test files.

Closes #324 #330.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@thedavidmeister has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 44 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4f850acd-243e-4de7-9319-cf0597e99f23

📥 Commits

Reviewing files that changed from the base of the PR and between ceaea3c and 8a632c0.

📒 Files selected for processing (2)
  • test/concrete/MaliciousReenteringToken.sol
  • test/src/concrete/Flow.transfer.t.sol
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-05-05-issue-324-330-reentrancy-guard-test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[A01-5] [LOW] flow nonReentrant guard untested

1 participant