Skip to content

onTakeOrders2 fires when the taker received zero tokens, contradicting the IRaindexV6OrderTaker NatSpec #2648

Description

@thedavidmeister

Summary

takeOrders4 gates the onTakeOrders2 callback only on config.data.length > 0not on whether any order actually filled. The IRaindexV6OrderTaker NatSpec documents the callback as firing "if it caused a non-zero input amount. I.e. if the order(s) taker received some tokens." When non-empty data is passed but every order is dead/skipped (so totalTakerInput == 0), the callback still fires (with inputAmountSent == 0).

Observed (verified on current main)

Repro testCallbackDoesNotFireOnZeroInput: a single never-added (dead) order is taken with data = 0x01; totalTakerInput == 0 (asserted as a precondition). The test asserts — per the interface NatSpec — that the callback does not fire. It fails on main: the callback fired with inputAmountSent == 0. pushTokens(.., 0) is a no-op so no tokens move, but the external call to onTakeOrders2 still happens.

RaindexV6.sol gates the call at roughly L587–590; the NatSpec is in IRaindexV6OrderTaker (raindex-interface).

Why it matters / triage

A code-vs-documented-contract divergence — ambiguous which side is canonical:

  • If the code is the bug: an unexpected external call to msg.sender mid-takeOrders that an integrator relying on the documented "you received tokens" contract would not anticipate.
  • If the NatSpec is stale: the interface doc should be corrected to match.

Either way, no existing test pins this gating in either direction (a coverage gap). Adjacent to I02 (#2625), which implicitly assumes the callback corresponds to a real settlement.

Provenance

Surfaced and verified by an adversarial review pass over current main. Repro on a throwaway scratch branch (uncommitted).

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions