Skip to content

2026 03 13 audit#2510

Merged
thedavidmeister merged 3 commits intomainfrom
2026-03-13-audit
Mar 14, 2026
Merged

2026 03 13 audit#2510
thedavidmeister merged 3 commits intomainfrom
2026-03-13-audit

Conversation

@thedavidmeister
Copy link
Contributor

@thedavidmeister thedavidmeister commented Mar 13, 2026

Motivation

Solution

Checks

By submitting this for review, I'm confirming I've done the following:

  • made this PR as small as possible
  • unit-tested any new functionality
  • linked any relevant issues or PRs
  • included screenshots (if this involves a front-end change)

Summary by CodeRabbit

  • Bug Fixes

    • Fixed flash loan amount calculation to use correct token decimals for proper precision.
    • Added validation to restrict flash loan callbacks to authorized order book deployments, preventing unauthorized access.
  • New Features

    • Enhanced test coverage for flash loan scenarios, including mixed-decimal handling, lender validation, and failure cases.
    • Added comprehensive integration tests for order-taking workflows.
  • Chores

    • Optimized contract size by reducing optimizer runs while maintaining functionality.
    • Updated configuration structures to remove redundant parameters.

thedavidmeister and others added 3 commits March 14, 2026 01:23
…rderBook from config

- Add BadLender check in onFlashLoan against deterministic orderbook address
- Fix flash loan amount using outputDecimals instead of inputDecimals
- Remove orderBook field from OrderBookV6ArbConfig (now compile-time constant)
- Add approve-call-revoke safety comments for A05-1/A06-1
- New tests: lender validation, mixed decimals, onTakeOrders2 end-to-end
- Refactor mocks to use MockOrderBookBase, etch at deterministic address
- Update triage.md with fix statuses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…NDED

OrderBookV6 was 74 bytes over the EIP-170 24KB contract size limit at
optimizer_runs=1000, causing deploy failure on Arbitrum. Lowering to 800
brings it to 23,437 bytes (1,139 under limit). Pointers regenerated.

Also adds FlashLoanFailed and RouteProcessor onTakeOrders2 tests,
extracts CONTEXT_COLUMNS_EXTENDED constant, and updates triage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This PR refactors OrderBookV6 arb contracts to use a deterministic deployed orderbook address instead of passing it as a constructor parameter, adds lender validation via BadLender error in flash borrowing, optimizes compiler settings to avoid contract size limits, extends context column definitions, and significantly expands test infrastructure with new mock base classes and comprehensive test scenarios.

Changes

Cohort / File(s) Summary
Compiler Configuration
foundry.toml
Reduced optimizer_runs from 1000 to 800 with explanatory comments on bytecode size impact to stay within EIP-170 24KB contract size limit.
Deployment Script
script/Deploy.sol
Removed LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS argument from OrderBookV6ArbConfig constructor calls in three arb-related deployments (GenericPoolOrderBookV6ArbOrderTaker, RouteProcessorOrderBookV6ArbOrderTaker, GenericPoolOrderBookV6FlashBorrower), changing function signature from (address, TaskV2, SignedContextV1[], string) to (TaskV2, SignedContextV1[], string).
Core Arb Contracts
src/abstract/OrderBookV6ArbCommon.sol, src/abstract/OrderBookV6FlashBorrower.sol
Removed orderBook address field from OrderBookV6ArbConfig struct; introduced BadLender error and lender validation in onFlashLoan to enforce calls only from deterministic ORDERBOOK_DEPLOYED_ADDRESS; fixed flash loan amount calculation in arb4 to use outputDecimals instead of inputDecimals.
Arb Implementation Details
src/concrete/arb/GenericPoolOrderBookV6ArbOrderTaker.sol, src/concrete/arb/GenericPoolOrderBookV6FlashBorrower.sol
Added explanatory comments on approve-call-revoke semantics and Slither directives suppressing unused-return warnings; no functional changes to token approval sequences.
Parser Updates
src/concrete/parser/OrderBookV6SubParser.sol
Replaced CONTEXT_COLUMNS with CONTEXT_COLUMNS_EXTENDED in buildOperandHandlerFunctionPointers and buildSubParserWordParsers, consolidating context column size derivations.
Library Constants
src/lib/LibOrderBook.sol, src/lib/LibOrderBookSubParser.sol
Introduced CONTEXT_COLUMNS_EXTENDED constant in LibOrderBook (CONTEXT_COLUMNS + 2 + 1 + 1 + 1 for signers, signed context start, deposit, withdraw); updated LibOrderBookSubParser.authoringMetaV2 to use the new constant instead of dynamic allocation.
Mock Test Infrastructure
test/util/abstract/MockOrderBookBase.sol, test/util/concrete/MockToken.sol, test/util/concrete/MockRouteProcessor.sol, test/util/concrete/MaliciousLender.sol
Introduced MockOrderBookBase abstract contract providing stubbed IRaindexV6 implementations; enhanced MockToken with decimals support; added MockRouteProcessor for route processing mock; introduced MaliciousLender for lender validation testing.
Realistic Mock Implementations
test/util/concrete/RealisticFlashLendingMockOrderBook.sol, test/util/concrete/RealisticOrderTakerMockOrderBook.sol
Refactored RealisticFlashLendingMockOrderBook to inherit from MockOrderBookBase with override modifiers; introduced RealisticOrderTakerMockOrderBook implementing takeOrders4 with realistic token interaction patterns.
Test Utilities & Base Classes
test/util/abstract/ArbTest.sol, test/util/concrete/ChildOrderBookV6ArbOrderTaker.sol, test/util/concrete/ChildOrderBookV6FlashBorrower.sol
Updated ArbTest to deploy FlashLendingMockOrderBook at deterministic address using LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS; removed address argument from OrderBookV6ArbConfig in child contract constructors.
Flash Borrower Tests
test/abstract/OrderBookV6FlashBorrower.badInitiator.t.sol, test/abstract/OrderBookV6FlashBorrower.flashLoanFailed.t.sol, test/abstract/OrderBookV6FlashBorrower.ierc165.t.sol, test/abstract/OrderBookV6FlashBorrower.lenderValidation.t.sol, test/abstract/OrderBookV6FlashBorrower.missingApproval.t.sol, test/abstract/OrderBookV6FlashBorrower.mixedDecimals.t.sol
Refactored badInitiator test to use deployed orderbook address and GenericPoolOrderBookV6FlashBorrower; added flashLoanFailed scenario with FalseFlashLoanMockOrderBook; updated ierc165 test to remove address argument; introduced lenderValidation test with MaliciousLender attack scenario; updated missingApproval to use deployed-address pattern with decimal-aware tokens; added mixedDecimals test validating arb4 with heterogeneous token decimals.
OrderTaker Tests
test/abstract/OrderBookV6ArbOrderTaker.onTakeOrders2.t.sol, test/concrete/arb/RouteProcessorOrderBookV6ArbOrderTaker.onTakeOrders2.t.sol
Introduced testArb5RealTokenTransfers in OrderBookV6ArbOrderTakerOnTakeOrders2Test covering full arb cycle with real token transfers; added testRouteProcessorArb5 in RouteProcessorOrderBookV6ArbOrderTakerOnTakeOrders2Test exercising route processor integration.

Sequence Diagram

sequenceDiagram
    actor Caller
    participant Lender as Malicious Lender
    participant FlashBorrower as OrderBookV6<br/>FlashBorrower
    participant OrderBook as Deterministic<br/>OrderBook
    participant Token as Token

    Caller->>Lender: attack(arb, token, amount)
    Lender->>Token: transfer(amount) to FlashBorrower
    Lender->>FlashBorrower: onFlashLoan(lender_addr, token, amount, data)
    Note over FlashBorrower: sender check:<br/>LibOrderBookDeploy.<br/>ORDERBOOK_DEPLOYED_ADDRESS
    alt sender == ORDERBOOK_DEPLOYED_ADDRESS
        FlashBorrower->>OrderBook: proceed with loan
    else sender != ORDERBOOK_DEPLOYED_ADDRESS
        FlashBorrower->>Caller: revert BadLender(sender)
    end
    
    rect rgba(200, 150, 100, 0.5)
    Note over Lender,OrderBook: Expected flow with<br/>legitimate orderbook
    Caller->>OrderBook: initiates flash loan
    OrderBook->>FlashBorrower: onFlashLoan(orderbook_addr, ...)
    FlashBorrower->>OrderBook: callback validated
    OrderBook->>Token: receive flashLoan repayment
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A whisker-twitching tale of arbs so fine,
Where orderbooks deploy on curves divine,
Malicious lenders fail their crafty plot,
For BadLender revert guards the borrowed spot!
With decimals extended and tests so bright,
The burrow's contracts flash through the night!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "2026 03 13 audit" is vague and does not meaningfully describe the changeset, using a date format that conveys no information about what was actually changed or fixed. Consider using a more descriptive title that summarizes the main changes, such as "Add BadLender validation and refactor OrderBookV6Arb tests" or "Fix flash loan security and reduce contract size for Arbitrum".
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2026-03-13-audit
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
test/abstract/OrderBookV6FlashBorrower.missingApproval.t.sol (1)

33-36: File name doesn't match test purpose.

The file is named OrderBookV6FlashBorrower.missingApproval.t.sol but the test function is testArb4RealTokenTransfers(). Consider renaming for clarity if "missing approval" is no longer the test's focus.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/abstract/OrderBookV6FlashBorrower.missingApproval.t.sol` around lines 33
- 36, The file name OrderBookV6FlashBorrower.missingApproval.t.sol no longer
matches the test's intent; rename the file to reflect the actual test (e.g.,
OrderBookV6FlashBorrower.realTokenTransfers.t.sol) or, if the file should still
test missing approvals, revert the test function name to reflect that purpose;
locate the test function testArb4RealTokenTransfers() in the
OrderBookV6FlashBorrower* contract and either change the filename to match this
function's real-token-transfer scenario or rename the function back to a
missing-approval-focused name so file and test purpose stay consistent.
test/abstract/OrderBookV6FlashBorrower.lenderValidation.t.sol (1)

23-23: Unused orderBook variable.

The orderBook variable is created but never used in the test. The test validates that MaliciousLender (as msg.sender) is rejected, which doesn't require the mock orderbook.

🧹 Remove unused variable
     function testMaliciousLenderCannotExploitOnFlashLoan() external {
-        RealisticFlashLendingMockOrderBook orderBook = new RealisticFlashLendingMockOrderBook();
         MockToken token = new MockToken("Token", "TKN", 18);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/abstract/OrderBookV6FlashBorrower.lenderValidation.t.sol` at line 23,
Remove the unused RealisticFlashLendingMockOrderBook instance: the test creates
orderBook via RealisticFlashLendingMockOrderBook orderBook = new
RealisticFlashLendingMockOrderBook(); but never uses it; simply delete that line
(or alternatively use the instance in the test assertion if you actually
intended to test interactions with RealisticFlashLendingMockOrderBook). Ensure
the test continues to assert that MaliciousLender (msg.sender) is rejected
without referencing orderBook.
test/concrete/arb/RouteProcessorOrderBookV6ArbOrderTaker.onTakeOrders2.t.sol (1)

79-93: Consider adding post-execution assertions.

The test currently only verifies that arb5 doesn't revert. Adding balance checks or state verification would strengthen the test coverage.

💡 Example assertions to add
         arb.arb5(
             IRaindexV6(address(orderBook)),
             TakeOrdersConfigV5({
                 minimumIO: LibDecimalFloat.packLossless(100, 0),
                 maximumIO: LibDecimalFloat.packLossless(type(int224).max, 0),
                 maximumIORatio: LibDecimalFloat.packLossless(type(int224).max, 0),
                 IOIsInput: true,
                 orders: orders,
                 data: takeOrdersData
             }),
             TaskV2({
                 evaluable: EvaluableV4(IInterpreterV4(address(0)), IInterpreterStoreV3(address(0)), hex""),
                 signedContext: new SignedContextV1[](0)
             })
         );
+
+        // Verify expected token movements occurred
+        // assertGt(inputToken.balanceOf(address(arb)), 0, "arb should have received input tokens");
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/concrete/arb/RouteProcessorOrderBookV6ArbOrderTaker.onTakeOrders2.t.sol`
around lines 79 - 93, Add concrete post-execution assertions after the
arb.arb5(...) call to verify expected state changes instead of only checking for
no revert: inspect balances and state on orderBook and involved accounts (e.g.,
check token or ETH balances of the taker and maker, verify filled amounts in
orderBook, or validate changes to orders/positions using the same
IRaindexV6/orderBook, orders, and takeOrdersData inputs). Use helpers or
existing getters on orderBook/IRaindexV6 and assert against expected values
derived from TakeOrdersConfigV5 (minimumIO/maximumIO/IOIsInput) and the orders
array to ensure the operation had the intended effect.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/abstract/OrderBookV6FlashBorrower.sol`:
- Around line 82-86: The code grants max allowance to a user-supplied orderBook
before validating it, allowing a malicious flashLoan to steal funds; update the
approval-call-revoke sequences in onFlashLoan and the similar block (around the
approval/flashLoan path using forceApprove/forceRevoke) to validate the
orderBook address before performing any approve/transferFrom/revoke actions by
checking that the provided orderBook equals
LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS and revert (BadLender) immediately
if not, or alternatively use LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS
directly for the approve/flashLoan/revoke flow to ensure approvals are only
given to the canonical orderBook.

In `@test/abstract/OrderBookV6ArbOrderTaker.onTakeOrders2.t.sol`:
- Around line 33-35: The test testArb5RealTokenTransfers currently only ensures
arb5 doesn't revert but doesn't assert token balances after
takeOrders/onTakeOrders2/finalize; add explicit balance assertions for
orderBook, exchange, and arb (arb5) after the flow to verify ERC20 transfers
occurred to the expected recipients. Locate the testArb5RealTokenTransfers
function and, after the onTakeOrders2 callback and finalize steps, fetch token
balances for the ERC20 used and assert that orderBook/exchange/arb balances
match the expected deltas (e.g., orderBook received seller funds, exchange
received fees/remaining, arb received profit), mirroring the same pattern for
the other affected test block around lines 80-94 (the other test that currently
only checks non-revert). Ensure you reference and use the same token contract
instance and transfer amounts used earlier in the test to compute expected
balances.

---

Nitpick comments:
In `@test/abstract/OrderBookV6FlashBorrower.lenderValidation.t.sol`:
- Line 23: Remove the unused RealisticFlashLendingMockOrderBook instance: the
test creates orderBook via RealisticFlashLendingMockOrderBook orderBook = new
RealisticFlashLendingMockOrderBook(); but never uses it; simply delete that line
(or alternatively use the instance in the test assertion if you actually
intended to test interactions with RealisticFlashLendingMockOrderBook). Ensure
the test continues to assert that MaliciousLender (msg.sender) is rejected
without referencing orderBook.

In `@test/abstract/OrderBookV6FlashBorrower.missingApproval.t.sol`:
- Around line 33-36: The file name
OrderBookV6FlashBorrower.missingApproval.t.sol no longer matches the test's
intent; rename the file to reflect the actual test (e.g.,
OrderBookV6FlashBorrower.realTokenTransfers.t.sol) or, if the file should still
test missing approvals, revert the test function name to reflect that purpose;
locate the test function testArb4RealTokenTransfers() in the
OrderBookV6FlashBorrower* contract and either change the filename to match this
function's real-token-transfer scenario or rename the function back to a
missing-approval-focused name so file and test purpose stay consistent.

In
`@test/concrete/arb/RouteProcessorOrderBookV6ArbOrderTaker.onTakeOrders2.t.sol`:
- Around line 79-93: Add concrete post-execution assertions after the
arb.arb5(...) call to verify expected state changes instead of only checking for
no revert: inspect balances and state on orderBook and involved accounts (e.g.,
check token or ETH balances of the taker and maker, verify filled amounts in
orderBook, or validate changes to orders/positions using the same
IRaindexV6/orderBook, orders, and takeOrdersData inputs). Use helpers or
existing getters on orderBook/IRaindexV6 and assert against expected values
derived from TakeOrdersConfigV5 (minimumIO/maximumIO/IOIsInput) and the orders
array to ensure the operation had the intended effect.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5f5def4c-2b88-4762-904a-265c3621e802

📥 Commits

Reviewing files that changed from the base of the PR and between cf56450 and 1a44ac7.

⛔ Files ignored due to path filters (3)
  • audit/2026-03-13-01/triage.md is excluded by !audit/**
  • src/generated/OrderBookV6.pointers.sol is excluded by !**/generated/**
  • src/generated/OrderBookV6SubParser.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (25)
  • foundry.toml
  • script/Deploy.sol
  • src/abstract/OrderBookV6ArbCommon.sol
  • src/abstract/OrderBookV6FlashBorrower.sol
  • src/concrete/arb/GenericPoolOrderBookV6ArbOrderTaker.sol
  • src/concrete/arb/GenericPoolOrderBookV6FlashBorrower.sol
  • src/concrete/parser/OrderBookV6SubParser.sol
  • src/lib/LibOrderBook.sol
  • src/lib/LibOrderBookSubParser.sol
  • test/abstract/OrderBookV6ArbOrderTaker.onTakeOrders2.t.sol
  • test/abstract/OrderBookV6FlashBorrower.badInitiator.t.sol
  • test/abstract/OrderBookV6FlashBorrower.flashLoanFailed.t.sol
  • test/abstract/OrderBookV6FlashBorrower.ierc165.t.sol
  • test/abstract/OrderBookV6FlashBorrower.lenderValidation.t.sol
  • test/abstract/OrderBookV6FlashBorrower.missingApproval.t.sol
  • test/abstract/OrderBookV6FlashBorrower.mixedDecimals.t.sol
  • test/concrete/arb/RouteProcessorOrderBookV6ArbOrderTaker.onTakeOrders2.t.sol
  • test/util/abstract/ArbTest.sol
  • test/util/abstract/MockOrderBookBase.sol
  • test/util/concrete/ChildOrderBookV6ArbOrderTaker.sol
  • test/util/concrete/MaliciousLender.sol
  • test/util/concrete/MockRouteProcessor.sol
  • test/util/concrete/MockToken.sol
  • test/util/concrete/RealisticFlashLendingMockOrderBook.sol
  • test/util/concrete/RealisticOrderTakerMockOrderBook.sol
💤 Files with no reviewable changes (4)
  • test/abstract/OrderBookV6FlashBorrower.ierc165.t.sol
  • script/Deploy.sol
  • test/util/concrete/ChildOrderBookV6ArbOrderTaker.sol
  • src/abstract/OrderBookV6ArbCommon.sol

Comment on lines 82 to +86
function onFlashLoan(address initiator, address, uint256, uint256, bytes calldata data) external returns (bytes32) {
// Only the deterministic orderbook deployment may call this callback.
if (msg.sender != LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS) {
revert BadLender(msg.sender);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Validate orderBook before the approval-call-revoke sequence.

The BadLender check on Lines 83-86 only executes if the user-supplied orderBook actually calls back into onFlashLoan. But Lines 157-159 give that address max allowances first, so a malicious flashLoan implementation can transferFrom any balances held by the borrower and return true without ever hitting the callback. Since this PR makes the lender deterministic, reject non-canonical orderBook values before the first forceApprove, or use LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS directly for the approval/flash-loan path.

Also applies to: 129-163

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/abstract/OrderBookV6FlashBorrower.sol` around lines 82 - 86, The code
grants max allowance to a user-supplied orderBook before validating it, allowing
a malicious flashLoan to steal funds; update the approval-call-revoke sequences
in onFlashLoan and the similar block (around the approval/flashLoan path using
forceApprove/forceRevoke) to validate the orderBook address before performing
any approve/transferFrom/revoke actions by checking that the provided orderBook
equals LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS and revert (BadLender)
immediately if not, or alternatively use
LibOrderBookDeploy.ORDERBOOK_DEPLOYED_ADDRESS directly for the
approve/flashLoan/revoke flow to ensure approvals are only given to the
canonical orderBook.

Comment on lines +33 to +35
/// arb5 completes a full order-taker cycle with real ERC20 transfers:
/// takeOrders, onTakeOrders2 callback with exchange, and finalize.
function testArb5RealTokenTransfers() external {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Assert the transfer results, not just the happy path.

The docstring on Lines 33-35 says this covers the full transfer cycle, but the body only proves arb5 doesn't revert. A regression where the callback succeeds but tokens land on the wrong contract would still pass unless you assert the post-call balances for orderBook, exchange, and arb.

💡 Example assertions
         arb.arb5(
             IRaindexV6(address(orderBook)),
             TakeOrdersConfigV5({
                 minimumIO: LibDecimalFloat.packLossless(100, 0),
                 maximumIO: LibDecimalFloat.packLossless(type(int224).max, 0),
                 maximumIORatio: LibDecimalFloat.packLossless(type(int224).max, 0),
                 IOIsInput: true,
                 orders: orders,
                 data: takeOrdersData
             }),
             TaskV2({
                 evaluable: EvaluableV4(IInterpreterV4(address(0)), IInterpreterStoreV3(address(0)), hex""),
                 signedContext: new SignedContextV1[](0)
             })
         );
+
+        assertEq(outputToken.balanceOf(address(orderBook)), 0);
+        assertEq(inputToken.balanceOf(address(orderBook)), 100e18);
+        assertEq(outputToken.balanceOf(address(exchange)), 100e18);
+        assertEq(inputToken.balanceOf(address(exchange)), 0);
+        assertEq(outputToken.balanceOf(address(arb)), 0);
+        assertEq(inputToken.balanceOf(address(arb)), 0);

Also applies to: 80-94

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/abstract/OrderBookV6ArbOrderTaker.onTakeOrders2.t.sol` around lines 33 -
35, The test testArb5RealTokenTransfers currently only ensures arb5 doesn't
revert but doesn't assert token balances after
takeOrders/onTakeOrders2/finalize; add explicit balance assertions for
orderBook, exchange, and arb (arb5) after the flow to verify ERC20 transfers
occurred to the expected recipients. Locate the testArb5RealTokenTransfers
function and, after the onTakeOrders2 callback and finalize steps, fetch token
balances for the ERC20 used and assert that orderBook/exchange/arb balances
match the expected deltas (e.g., orderBook received seller funds, exchange
received fees/remaining, arb received profit), mirroring the same pattern for
the other affected test block around lines 80-94 (the other test that currently
only checks non-revert). Ensure you reference and use the same token contract
instance and transfer amounts used earlier in the test to compute expected
balances.

@thedavidmeister thedavidmeister merged commit c06a8c3 into main Mar 14, 2026
17 of 18 checks passed
@github-actions
Copy link
Contributor

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR diff stats excluding lock files
gh pr diff 2510 --repo rainlanguage/rain.orderbook --name-only | grep -v -E "(package-lock\.json|yarn\.lock|pnpm-lock\.yaml|Cargo\.lock)"

echo "---STATS---"
gh api repos/rainlanguage/rain.orderbook/pulls/2510/files --paginate | jq '[.[] | select(.filename | test("(package-lock\\.json|yarn\\.lock|pnpm-lock\\.yaml|Cargo\\.lock)") | not)] | {total_files: length, additions: map(.additions) | add, deletions: map(.deletions) | add, total: map(.changes) | add}'

Length of output: 1380


SIZE=L


🧠 Learnings used
Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:42.275Z
Learning: For PR `#1884`, after each commit review, I should provide a new comment with a PR size report in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding irrelevant files such as lock files (package-lock.json, cargo.lock, etc.).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:42.275Z
Learning: After each commit in PR `#1884`, I should provide a new comment with the PR size report in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`. The report should exclude irrelevant files such as lock files (e.g., package-lock.json, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:25:47.873Z
Learning: After each new commit review for rainlanguage/rain.orderbook repository, generate a PR size report in a separate comment with the format: "TOTAL=number ADDITIONS=number DELETIONS=number". This report should exclude irrelevant files such as lock files (e.g., package-lock.json, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:25:47.873Z
Learning: After each new commit review for rainlanguage/rain.orderbook repository, generate a PR size report in a separate comment with the exact format: "TOTAL=number\nADDITIONS=number\nDELETIONS=number". This report should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:14:22.646Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, I must consistently report the PR size after EVERY new commit in the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number" without any additional text or formatting blocks. The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock) and can be included either as part of the review or as a separate comment.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T22:46:08.530Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, the PR size report should be the only content in the comment - no text before it, no text after it, no formatting blocks, just the raw report in the exact format: "TOTAL=number\nADDITIONS=number\nDELETIONS=number". The report must exclude lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1971
File: .github/workflows/vercel-docs-prod.yaml:32-34
Timestamp: 2025-07-11T12:30:09.245Z
Learning: findolor prefers not to pin Node versions explicitly in GitHub Actions workflows when using Nix with webapp-shell, considering the current setup sufficient for deterministic builds in the rainlanguage/rain.orderbook project.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 1971
File: .github/workflows/vercel-docs-prod.yaml:10-14
Timestamp: 2025-07-11T12:29:49.284Z
Learning: In GitHub Actions workflows for the rainlanguage/rain.orderbook project, findolor is comfortable with job names that may seem misleading (like "Deploy-Docs-Preview" in a production workflow) when there's only one job in the workflow, as the context makes it clear enough.

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:26:31.566Z
Learning: For PR `#1884` and future PRs in rainlanguage/rain.orderbook repository, provide PR size reports in a separate comment with ONLY the exact format "TOTAL=number\nADDITIONS=number\nDELETIONS=number", without any additional text or explanation. Reports should exclude irrelevant files such as lock files (package-lock.json, yarn.lock, pnpm-lock.yaml, cargo.lock).

Learnt from: rouzwelt
Repo: rainlanguage/rain.orderbook PR: 0
File: :0-0
Timestamp: 2025-05-21T21:24:53.708Z
Learning: For PR `#1884` in rainlanguage/rain.orderbook, provide a separate comment after each review with PR size statistics in the format: `TOTAL=number ADDITIONS=number DELETIONS=number`, excluding lock files like package-lock.json and cargo.lock.

Learnt from: findolor
Repo: rainlanguage/rain.orderbook PR: 2000
File: crates/common/src/raindex_client/vaults.rs:183-183
Timestamp: 2025-07-16T10:40:05.717Z
Learning: In the rainlanguage/rain.orderbook codebase, user findolor considers breaking changes from Option<U256> to U256 for required fields like decimals in RaindexVaultToken to be acceptable and safe, even when they affect multiple usage sites across the codebase.

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.

1 participant