test reentrancy guard on store + ERC721/ERC1155 recipient paths#471
test reentrancy guard on store + ERC721/ERC1155 recipient paths#471thedavidmeister wants to merge 1 commit intomainfrom
Conversation
The `Flow.flow` `nonReentrant` guard has four documented entry points (LibFlow.sol:142). PR #446 covers ERC20/ERC777-style reentrancy via a malicious token. This adds tests for the remaining three: 1. Malicious interpreter store: `MaliciousReenteringStore.set` re-enters `flow.flow`. Etched at the framework's STORE address. 2. Malicious ERC721 recipient: `MaliciousReenteringRecipient .onERC721Received` re-enters. The framework's TOKEN_B is etched with `StubERC721WithReceiverHook` so the underlying `safeTransferFrom` call propagates into the recipient hook. 3. Malicious ERC1155 recipient: same shape via `StubERC1155WithReceiverHook` at TOKEN_C and `onERC1155Received`. Mutation verified: dropping `nonReentrant` from `Flow.flow` makes all three new tests fail; reverting passes. Closes #309. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ 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. Comment |
Summary
Flow.flowcarriesnonReentrantand theLibFlow.flowNatSpec names four reentrancy entry points. PR #446 covers ERC20/ERC777-style reentrancy via a malicious token. This adds tests for the remaining three:MaliciousReenteringStore.setre-entersflow.flow. Etched at the framework'sSTOREaddress. Storage slots from the deployed contract are copied across so the etched code retains its evaluable.MaliciousReenteringRecipient.onERC721Receivedre-enters. The framework'sTOKEN_Bis etched withStubERC721WithReceiverHookso the underlyingsafeTransferFromcall propagates into the recipient hook (the standard mock token does not call the hook).StubERC1155WithReceiverHookatTOKEN_CandonERC1155Received.Mutation verified: dropping
nonReentrantfromFlow.flowmakes all three new tests fail; reverting passes.Replaces the closed PR #440 (NatSpec-only enumeration). Closes #309.
Test plan
nonReentrant→ all 3 fail🤖 Generated with Claude Code