Skip to content

Use IRaindexV6.TokenSelfTrade from raindex-interface 0.1.3#2796

Open
thedavidmeister wants to merge 4 commits into
mainfrom
chore/use-interface-token-self-trade
Open

Use IRaindexV6.TokenSelfTrade from raindex-interface 0.1.3#2796
thedavidmeister wants to merge 4 commits into
mainfrom
chore/use-interface-token-self-trade

Conversation

@thedavidmeister

@thedavidmeister thedavidmeister commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Companion to rainlanguage/raindex.interface#64 (which declared TokenSelfTrade on IRaindexV6): an interface declaration is only meaningful if the implementation uses it, so this PR makes raindex consume the interface's declaration instead of keeping a duplicate.

  • Bump raindex-interface 0.1.1 → 0.1.3 (foundry.toml + remappings + soldeer.lock + all import paths).
  • Delete the local file-scope error TokenSelfTrade(); in RaindexV6.sol — the three revert sites (checkTokenSelfTrade used by quote2/takeOrders4, and the inline clear3 guard) now bind to the inherited IRaindexV6.TokenSelfTrade.
  • Tests reference the error via IRaindexV6.TokenSelfTrade.selector; one dead TokenSelfTrade import removed from RaindexV6.quote.t.sol.

This matches the existing convention: the other 9 interface-declared errors (NoOrders, ZeroVaultId, …) are already used from the interface without local duplicates.

Verification

  • Creation bytecode is byte-identical to main (sha256 35d21e65… before and after; bytecode_hash = "none", cbor_metadata = false) — same error signature ⇒ same selector ⇒ no redeploy implied, prod pins unaffected.
  • All 7 self-trade tests pass (quote/clear/takeOrder sameToken, calculateOrderIOHarness, freshDriver, freshMutation, deadOrder).
  • script/build.sh regenerated; any artifact diffs are staged in the commit.

Refs #2671 (item 6).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated the app to use a newer compatible interface package, improving build reliability and dependency consistency.
    • Standardized self-trade error handling so related checks use the current error reference.
  • Tests
    • Aligned the test suite with the updated interface version across order-taking, clearing, flash-loan, and utility scenarios.

Bump raindex-interface 0.1.1 -> 0.1.3 and drop the local file-scope
TokenSelfTrade declaration; the three revert sites now bind to the
error declared on IRaindexV6, and tests reference it via the interface.
Creation bytecode is byte-identical to main (bytecode_hash=none), so
no redeploy is implied.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@thedavidmeister, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7db3f19f-bf47-4291-824e-87617eaf870d

📥 Commits

Reviewing files that changed from the base of the PR and between 63dd355 and a968e77.

📒 Files selected for processing (4)
  • crates/bindings/abis/IRaindexV6.json
  • foundry.toml
  • src/concrete/raindex/RaindexV6.sol
  • test/concrete/raindex/RaindexV6.calculateOrderIOHarness.t.sol
📝 Walkthrough

Walkthrough

This PR bumps the raindex-interface Soldeer dependency from 0.1.1 to 0.1.3 across foundry.toml, remappings.txt, and all import statements in source, library, and test files. It also removes the locally-declared TokenSelfTrade error from RaindexV6.sol, updating affected test revert expectations to reference IRaindexV6.TokenSelfTrade.selector.

Changes

Raindex interface dependency bump

Layer / File(s) Summary
Dependency configuration
foundry.toml, remappings.txt
Bumps the raindex-interface version from 0.1.1 to 0.1.3.
Source contracts and libraries
src/abstract/*.sol, src/lib/*.sol, src/concrete/raindex/RaindexV6.sol
Updates imports to raindex-interface-0.1.3 and removes the local TokenSelfTrade error declaration from RaindexV6.sol (revert usage retained via the interface).
Abstract test suites
test/abstract/*.t.sol
Updates IRaindexV6/TaskV2/Float/IERC3156FlashBorrower/IERC3156FlashLender imports to 0.1.3 for ArbOrderTaker, ArbTaskGated, FlashBorrower, and FlashLender tests.
Concrete arb test suites
test/concrete/arb/*.t.sol
Updates IRaindexV6/Float imports to 0.1.3 for GenericPool and RouteProcessor arb order taker/flash borrower tests.
Concrete RaindexV6 test suites
test/concrete/raindex/*.t.sol
Updates imports to 0.1.3 across addOrder, deposit, clear, quote, takeOrder, withdraw, vaultBalance, entask tests; updates TokenSelfTrade selector references to IRaindexV6.TokenSelfTrade.selector in affected tests.
Lib tests and util mocks/harnesses
test/lib/*.t.sol, test/util/**/*.sol
Updates imports across LibOrder/LibRaindex/LibRaindexArb tests and all mock/harness/stub contracts used by tests.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • rainlanguage/raindex#2586: Prior soldeer migration pinned the same raindex-interface dependencies that this PR now bumps to 0.1.3.
  • rainlanguage/raindex#2697: Adds RaindexV6ArbOrderTakerIoIndexSelectionTest in the same file whose import version this PR updates.
  • rainlanguage/raindex#2738: Modifies the same RaindexV6.calculateOrderIOHarness.t.sol harness that this PR updates for the interface/selector change.

Suggested reviewers: hardyjosh, 0xgleb, JuaniRios

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: switching TokenSelfTrade to the IRaindexV6 declaration from raindex-interface 0.1.3.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/use-interface-token-self-trade

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.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/concrete/raindex/RaindexV6.takeOrder.freshMutation.t.sol (1)

331-332: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use IRaindexV6.TokenSelfTrade.selector instead of a hardcoded hash.

Other self-trade tests in this PR were updated to reference IRaindexV6.TokenSelfTrade.selector directly (per PR objectives), but this one still manually recomputes the selector via keccak256("TokenSelfTrade()"). Functionally equivalent today, but it's inconsistent with the rest of the cohort and won't automatically track future signature changes to the interface error.

♻️ Proposed fix
-        // selector for TokenSelfTrade() as declared on IRaindexV6.
-        vm.expectRevert(bytes4(keccak256("TokenSelfTrade()")));
+        vm.expectRevert(IRaindexV6.TokenSelfTrade.selector);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/concrete/raindex/RaindexV6.takeOrder.freshMutation.t.sol` around lines
331 - 332, In RaindexV6.takeOrder.freshMutation.t.sol, the TokenSelfTrade revert
expectation is still computed manually with keccak256 instead of using the
interface-defined selector. Update the self-trade assertion in the relevant test
to reference IRaindexV6.TokenSelfTrade.selector directly so it stays consistent
with the other tests and automatically follows any future error signature
changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/concrete/raindex/RaindexV6.takeOrder.freshMutation.t.sol`:
- Around line 331-332: In RaindexV6.takeOrder.freshMutation.t.sol, the
TokenSelfTrade revert expectation is still computed manually with keccak256
instead of using the interface-defined selector. Update the self-trade assertion
in the relevant test to reference IRaindexV6.TokenSelfTrade.selector directly so
it stays consistent with the other tests and automatically follows any future
error signature changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a4729e7c-45a5-4450-8066-3442429a096e

📥 Commits

Reviewing files that changed from the base of the PR and between 6ad5a74 and 63dd355.

⛔ Files ignored due to path filters (1)
  • soldeer.lock is excluded by !**/*.lock
📒 Files selected for processing (141)
  • foundry.toml
  • remappings.txt
  • src/abstract/RaindexV6ArbCommon.sol
  • src/abstract/RaindexV6ArbOrderTaker.sol
  • src/abstract/RaindexV6ArbTaskGated.sol
  • src/abstract/RaindexV6FlashBorrower.sol
  • src/abstract/RaindexV6FlashLender.sol
  • src/concrete/raindex/RaindexV6.sol
  • src/lib/LibOrder.sol
  • src/lib/LibRaindex.sol
  • src/lib/LibRaindexArb.sol
  • test/abstract/RaindexV6ArbOrderTaker.badRaindex.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.beforeArbOrder.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.context.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.finalizeDecimals.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.finalizeTaskArg.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.ierc165.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.ioIndexSelection.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.noOrders.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.onTakeOrders2.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.onTakeOrders2Base.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.onTakeOrders2Direct.t.sol
  • test/abstract/RaindexV6ArbOrderTaker.reentrancy.t.sol
  • test/abstract/RaindexV6ArbTaskGated.checkTaskHashPassMatch.t.sol
  • test/abstract/RaindexV6ArbTaskGated.checkTaskHashPassZero.t.sol
  • test/abstract/RaindexV6ArbTaskGated.checkTaskHashWrongTask.t.sol
  • test/abstract/RaindexV6ArbTaskGated.construct.t.sol
  • test/abstract/RaindexV6ArbTaskGated.iTaskHashBoundary.t.sol
  • test/abstract/RaindexV6ArbTaskGated.iTaskHashNonzero.t.sol
  • test/abstract/RaindexV6ArbTaskGated.iTaskHashZero.t.sol
  • test/abstract/RaindexV6FlashBorrower.badLenderApproval.t.sol
  • test/abstract/RaindexV6FlashBorrower.beforeArbOrder.t.sol
  • test/abstract/RaindexV6FlashBorrower.finalizeDecimals.t.sol
  • test/abstract/RaindexV6FlashBorrower.flashLoanAmountLossless.t.sol
  • test/abstract/RaindexV6FlashBorrower.flashLoanAmountValue.t.sol
  • test/abstract/RaindexV6FlashBorrower.flashLoanFailed.t.sol
  • test/abstract/RaindexV6FlashBorrower.inputIoIndexSelection.t.sol
  • test/abstract/RaindexV6FlashBorrower.ioIsInput.t.sol
  • test/abstract/RaindexV6FlashBorrower.mixedDecimals.t.sol
  • test/abstract/RaindexV6FlashBorrower.noOrders.t.sol
  • test/abstract/RaindexV6FlashBorrower.orders0Selection.t.sol
  • test/abstract/RaindexV6FlashBorrower.realTokenTransfers.t.sol
  • test/abstract/RaindexV6FlashBorrower.reentrancy.t.sol
  • test/abstract/RaindexV6FlashLender.griefRecipient.t.sol
  • test/abstract/RaindexV6FlashLender.mockSuccess.t.sol
  • test/abstract/RaindexV6FlashLender.reentrant.t.sol
  • test/abstract/RaindexV6FlashLender.transfers.t.sol
  • test/concrete/arb/GenericPoolRaindexV6ArbOrderTaker.sender.t.sol
  • test/concrete/arb/GenericPoolRaindexV6FlashBorrower.exchangeTokenSelection.t.sol
  • test/concrete/arb/GenericPoolRaindexV6FlashBorrower.sender.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.lossyRounding.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.noEthForward.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.nonStandardDecimals.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.onTakeOrders2.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.onTakeOrders2Direct.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.onTakeOrders2Fuzz.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.sender.t.sol
  • test/concrete/arb/RouteProcessorRaindexV6ArbOrderTaker.tofuDecimals.t.sol
  • test/concrete/raindex/RaindexV6.addOrder.entask.t.sol
  • test/concrete/raindex/RaindexV6.addOrder.mock.t.sol
  • test/concrete/raindex/RaindexV6.addOrder.nonce.t.sol
  • test/concrete/raindex/RaindexV6.addOrder.owner.t.sol
  • test/concrete/raindex/RaindexV6.addOrder.t.sol
  • test/concrete/raindex/RaindexV6.calculateOrderIOHarness.t.sol
  • test/concrete/raindex/RaindexV6.clear.badStack.t.sol
  • test/concrete/raindex/RaindexV6.clear.calculateStateChange.t.sol
  • test/concrete/raindex/RaindexV6.clear.context.t.sol
  • test/concrete/raindex/RaindexV6.clear.deadOrder.t.sol
  • test/concrete/raindex/RaindexV6.clear.freshDriver.t.sol
  • test/concrete/raindex/RaindexV6.clear.handleIO.revert.t.sol
  • test/concrete/raindex/RaindexV6.clear.mock.t.sol
  • test/concrete/raindex/RaindexV6.clear.sameOwner.t.sol
  • test/concrete/raindex/RaindexV6.clear.sameToken.t.sol
  • test/concrete/raindex/RaindexV6.clear.zeroAmount.t.sol
  • test/concrete/raindex/RaindexV6.deposit.entask.t.sol
  • test/concrete/raindex/RaindexV6.deposit.t.sol
  • test/concrete/raindex/RaindexV6.depositWithdrawHarness.t.sol
  • test/concrete/raindex/RaindexV6.doPost.fresh.t.sol
  • test/concrete/raindex/RaindexV6.entask.t.sol
  • test/concrete/raindex/RaindexV6.multicall.t.sol
  • test/concrete/raindex/RaindexV6.orderMgmt.fresh.t.sol
  • test/concrete/raindex/RaindexV6.quote.sameToken.t.sol
  • test/concrete/raindex/RaindexV6.quote.t.sol
  • test/concrete/raindex/RaindexV6.removeOrder.entask.t.sol
  • test/concrete/raindex/RaindexV6.removeOrder.mock.t.sol
  • test/concrete/raindex/RaindexV6.removeOrder.owner.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.badStack.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.batchEvalConsistency.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.batchStateAdversarial.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.batchStateBypass.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.calculationsContext.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.exceedsMaxRatio.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.freshMutation.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.freshVaultZero.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.handleIO.revert.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.maximumInput.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.maximumOutput.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.minimumIO.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.minimumIOOutput.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.noop.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.precision.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.sameToken.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.takenFlag.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.tokenMismatch.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.vaultZeroInput.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.zeroAmount.t.sol
  • test/concrete/raindex/RaindexV6.takeOrder.zeroMaxOOBIndex.t.sol
  • test/concrete/raindex/RaindexV6.vaultBalance.t.sol
  • test/concrete/raindex/RaindexV6.vaultBalanceVault0.t.sol
  • test/concrete/raindex/RaindexV6.withdraw.entask.t.sol
  • test/concrete/raindex/RaindexV6.withdraw.t.sol
  • test/lib/LibOrder.t.sol
  • test/lib/LibRaindex.doPost.t.sol
  • test/lib/LibRaindexArb.finalizeArbTaskContext.t.sol
  • test/util/abstract/IRaindexV6Stub.sol
  • test/util/abstract/MockRaindexBase.sol
  • test/util/abstract/RaindexV6ExternalMockTest.sol
  • test/util/abstract/RaindexV6ExternalRealTest.sol
  • test/util/concrete/Alice.sol
  • test/util/concrete/ChildGatedRaindexV6ArbOrderTaker.sol
  • test/util/concrete/ChildGatedRaindexV6FlashBorrower.sol
  • test/util/concrete/ChildRaindexV6ArbTaskGated.sol
  • test/util/concrete/FlashLendingMockRaindex.sol
  • test/util/concrete/LeftoverFlashLendingMockRaindex.sol
  • test/util/concrete/LibRaindexArbFinalizeHarness.sol
  • test/util/concrete/LibRaindexDoPostHarness.sol
  • test/util/concrete/MaliciousRaindex.sol
  • test/util/concrete/RaindexV6CalculateOrderIOHarness.sol
  • test/util/concrete/RaindexV6ClearStateChangeHarness.sol
  • test/util/concrete/RealisticFlashLendingMockRaindex.sol
  • test/util/concrete/RealisticOrderTakerMockRaindex.sol
  • test/util/concrete/RecordingFlashLendingMockRaindex.sol
  • test/util/concrete/RecordingOrderTaker.sol
  • test/util/concrete/RecordingTaker.sol
  • test/util/concrete/Reenteroor.sol
  • test/util/concrete/ReentrantExchange.sol
  • test/util/concrete/ReentrantMockRaindex.sol
  • test/util/lib/LibTestAddOrder.sol
  • test/util/lib/LibTestArb.sol
  • test/util/lib/LibTestFlashBorrowerArb.sol
  • test/util/lib/LibTestTakeOrder.sol

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thedavidmeister thedavidmeister added the ai:ready AI vetter: passes review, ready for human decision label Jul 6, 2026
@thedavidmeister

thedavidmeister commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

🤖 ai:vetter
Reviewed 97c0e17: ready — raindex-interface 0.1.1 to 0.1.3; removes local TokenSelfTrade error; uses IRaindexV6.TokenSelfTrade
cost 500 — ~100 files but all mechanical remapping bumps; bytecode parity claim needs human spot-check

@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:vetter
Reviewed a968e77: ready — refs #2671 item 6 — raindex-interface 0.1.1→0.1.3 (interface PR #64 merged, declares TokenSelfTrade); local error deleted, revert sites bind inherited IRaindexV6.TokenSelfTrade, selector-identical so bytecode-parity claim sound; ~95 files are mechanical remapping bumps; 3 red checks identical on docs-only #2798 so pre-existing main reds
cost 485 — dep bump + error relocation, parity spot-check

@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:producer
Producer note: all three red checks are MAIN-STATE, not PR-caused — rainix-sol/test fails testAllPublishedSoldeerTagsHaveAFullConstantSuite (0.1.13 published without deploy-constant pins, identical on main), and rainix-sol/static + rs-static fail the no-vm.skip gate on 5 pre-existing test/lib/deploy files on main. Nothing fixable from this branch.

@thedavidmeister thedavidmeister added ai:blocked-on AI producer: blocked on a dependency PR and removed ai:ready AI vetter: passes review, ready for human decision labels Jul 12, 2026
@thedavidmeister

Copy link
Copy Markdown
Contributor Author

🤖 ai:producer
Blocked-on: Reds are the main-state trio (rainix-sol static/test + rs-static: banned vm.skip usages + missing 0.1.13 deploy constants) inherited by every open PR — same failing-check signature as the #2798 sample verified against the logs. Fix is #2804; greens after it lands and this branch updates.

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

Labels

ai:blocked-on AI producer: blocked on a dependency PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant