Skip to content

clear3: run NegativeBounty guard before any vault settlement (#2671)#2732

Open
thedavidmeister wants to merge 1 commit into
mainfrom
2026-06-13-issue-2671-negbounty-ordering
Open

clear3: run NegativeBounty guard before any vault settlement (#2671)#2732
thedavidmeister wants to merge 1 commit into
mainfrom
2026-06-13-issue-2671-negbounty-ordering

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

Split out of #2692 for independent review (issue #2671). Re-implemented on current main post-#2701. Note: testProdDeploy*/start-block/constant-suite tests are red pending the serial deploy at land time.

In clear3 the NegativeBounty guard ran after vault settlement
(recordVaultOutput / recordVaultInput / pushVaultZeroInput). A spread with
a vault-0 input against an orderbook with zero ambient balance reverts
ERC20InsufficientBalance from the vault-0 push before the explicit guard,
so the opaque ERC20 error pre-empts NegativeBounty().

Move the guard to immediately after calculateClearStateChange, before any
settlement, so a negative bounty always reverts with the explicit
NegativeBounty() error. Behaviour is otherwise unchanged: the same
spread that reverted before still reverts, just with the typed error.

Item 2 of #2671; split out of the bundled #2692 for independent review and
re-implemented on current main (post-#2701).

Adds testClearNegativeBountyVaultZeroRevertsNegativeBounty to
RaindexV6.takeOrder.vaultZeroInput.t.sol: both orders take and give via
vault 0 against a zero-ambient-balance orderbook and cross into a
-0.5 bounty; the guard must revert NegativeBounty() ahead of the vault-0
push. Regenerated RaindexV6 pointers + dependent arb/flash-borrower
pointers + test_fixtures ABI for the new bytecode.

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

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

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

More reviews will be available in 37 minutes and 57 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b5de0c4f-511a-44cd-a696-faf86fb97960

📥 Commits

Reviewing files that changed from the base of the PR and between 31e7a49 and c9c149c.

⛔ Files ignored due to path filters (4)
  • src/generated/GenericPoolRaindexV6ArbOrderTaker.pointers.sol is excluded by !**/generated/**
  • src/generated/GenericPoolRaindexV6FlashBorrower.pointers.sol is excluded by !**/generated/**
  • src/generated/RaindexV6.pointers.sol is excluded by !**/generated/**
  • src/generated/RouteProcessorRaindexV6ArbOrderTaker.pointers.sol is excluded by !**/generated/**
📒 Files selected for processing (3)
  • crates/test_fixtures/abis/RaindexV6.json
  • src/concrete/raindex/RaindexV6.sol
  • test/concrete/raindex/RaindexV6.takeOrder.vaultZeroInput.t.sol
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-06-13-issue-2671-negbounty-ordering

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.

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