Skip to content

Clear revert#2092

Merged
thedavidmeister merged 5 commits intov4from
2025-08-18-clear-revert
Aug 18, 2025
Merged

Clear revert#2092
thedavidmeister merged 5 commits intov4from
2025-08-18-clear-revert

Conversation

@Siddharth2207
Copy link
Copy Markdown
Contributor

@Siddharth2207 Siddharth2207 commented Aug 18, 2025

Motivation

Clear revert

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

    • Improved rounding in order clearing and withdrawals to prevent overflow and ensure accurate balances.
  • Chores

    • Removed docs preview and production deployment workflows.
    • Updated deployment workflow to target the v4 environment.
    • Refreshed subgraph configurations with new contract addresses and start blocks for Base and Arbitrum.
  • Tests

    • Added tests covering rounding behavior in withdrawals.
    • Added tests for clear operation with IO handling and revert scenarios.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Removes Vercel docs preview/prod GitHub Actions workflows, updates vercel-prod workflow to use branch/environment target v4, changes rounding/overflow handling in OrderBook withdraw and clear logic, updates subgraph contract addresses/startBlocks for Base and Arbitrum One, and adds new rounding-focused tests for clear2 and withdraw2.

Changes

Cohort / File(s) Summary of changes
CI Workflows
.github/workflows/vercel-docs-preview.yaml, .github/workflows/vercel-docs-prod.yaml, .github/workflows/vercel-prod.yaml
Deleted preview and prod docs deployment workflows. Modified vercel-prod: push branch from main→v4; vercel pull/deploy target from production/prod→v4.
OrderBook Core Logic
src/concrete/ob/OrderBook.sol
Withdraw: rescale overflow handling switched to saturating mode. Clear: revised Alice output calculation to include rounding-aware correction using up/down rescaling and IORatio. No public signatures changed.
Subgraph Config
subgraph/networks.json
Updated OrderBook addresses and startBlocks for base and arbitrum-one networks.
Tests (Rounding/IO/Revert)
test/concrete/ob/OrderBook.clear.rounding.revert.t.sol, test/concrete/ob/OrderBook.withdraw.rounding.t.sol
Added tests: clear2 IO rounding/revert scenarios; withdraw2 rounding with large amount and zero balance. Introduces new test contract(s).

Sequence Diagram(s)

sequenceDiagram
  participant User as User (caller)
  participant OB as OrderBook
  participant Tok as ERC20

  Note over OB: withdraw2 (saturating rescale)
  User->>OB: withdraw2(token, vaultId, targetAmount, tasks)
  OB->>OB: Rescale targetAmount with FLAG_SATURATE
  OB-->>User: Emits Withdraw (adjusted amount)
  OB->>Tok: transfer(to, amount)
Loading
sequenceDiagram
  participant Carol as clearer
  participant OB as OrderBook
  participant Alice as Alice Order
  participant Bob as Bob Order

  Note over OB: clear2 (Alice rounding-aware correction)
  Carol->>OB: clear2(Alice, Bob, clearConfig, …)
  OB->>OB: Compute aliceInputUp (18d) and aliceInput (token d)
  OB->>OB: If diff, adjust aliceOutputMax18 via IORatio (ceil div)
  OB-->>Carol: Clear result/events
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Clear rounding revert #2090 — Adjusts OrderBook rounding logic in withdraw2/clear2 with related tests; overlaps the same code paths.
  • Withdraw revert #2085 — Similar changes to OrderBook rounding and adds corresponding tests; touches the same files.
  • arb and base sg #1964 — Updates subgraph/networks.json for OrderBook addresses/startBlocks on Base and Arbitrum; same fields modified.

Suggested labels

test

Suggested reviewers

  • hardyjosh
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2025-08-18-clear-revert

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Siddharth2207 Siddharth2207 changed the base branch from main to v4 August 18, 2025 13:07
@thedavidmeister thedavidmeister merged commit 3182555 into v4 Aug 18, 2025
17 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Sep 3, 2025
4 tasks
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.

2 participants