pin stack-tuple field order against ERC{20,721,1155}Transfer structs#439
Conversation
LibFlow.stackToFlow casts each consumed sentinel-tuple memory region to ERC20Transfer / ERC721Transfer / ERC1155Transfer via inline assembly. The cast assumes a fixed positional layout (token, from, to, [id,] amount) that matches the rainlang author's stack convention — but the existing roundtrip tests use named-field struct construction so they silently track any reorder of the struct definition without catching the divergence with the rainlang convention. Two changes: 1. SAFETY comments above each cast in LibFlow.stackToFlow naming the exact positional contract per token type. 2. testFlowStackToFlowFieldOrderPinned builds a stack by hand with distinct markers per field — exactly what a rainlang author writes — and asserts each field by name on the result struct. Mutation verified: swapping `from` and `to` in `ERC20Transfer` makes the test fail; reverting passes. Closes #308. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
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 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 ignored due to path filters (1)
📒 Files selected for processing (2)
✨ 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 53 minutes and 36 seconds.Comment |
Summary
LibFlow.stackToFlowcasts each consumed sentinel-tuple memory region toERC20Transfer/ERC721Transfer/ERC1155Transfervia inline assembly. The cast assumes a fixed positional layout(token, from, to, [id,] amount)matching the rainlang author's stack convention — but the existing roundtrip tests use named-field struct construction so they silently track any reorder of the struct definition without catching divergence with the rainlang convention.Two changes:
LibFlow.stackToFlownaming the exact positional contract per token type.testFlowStackToFlowFieldOrderPinnedbuilds a stack by hand with distinct markers per field — exactly what a rainlang author writes — and asserts each field by name on the result struct. Mutation verified: swappingfromandtoinERC20Transfermakes the test fail; reverting passes.Also bumps the rainix flake input.
Closes #308.
Test plan
rainix-sol-test— 28/28rainix-sol-static— exit 0from/toinERC20Transferfails the new test (caught)🤖 Generated with Claude Code