feat(depth): walkPoolDepth per-region depth walk (0.17.0) - #65
Merged
Conversation
maxFillablePerpDelta's tick walk, emitting each constant-liquidity region (price bounds, terminating tick, active liquidity, perp and USD legs) instead of a single sum, to feed order book style depth displays. Amount rounding matches computeSwapStepToken0 at tick boundaries, so the new invariant tests hold against the V4Quoter-anchored mainnet fixture: per-side totals equal maxFillablePerpDelta exactly, and cumulative USD over every region prefix reproduces simulateTakerSwapExact to the wei. Also backfills the missing 0.15.0 / 0.16.0 CHANGELOG entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds exported tick-walking pool depth computation for long and short sides, validates region outputs against exact swap simulation, and updates release notes and package version to 0.17.0. ChangesPool depth walking
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant UnitTests
participant walkPoolDepth
participant PoolTickMap
participant swapMath
UnitTests->>walkPoolDepth: request one-sided pool depth
walkPoolDepth->>PoolTickMap: traverse initialized ticks
walkPoolDepth->>swapMath: compute token0 and token1 deltas
swapMath-->>walkPoolDepth: return regional deltas
walkPoolDepth-->>UnitTests: return DepthRegion rows
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
walkPoolDepthexport:maxFillablePerpDelta's tick walk emitting each constant-liquidity region (DepthRegion: price bounds, terminating tick, active liquidity, perp and USD legs) instead of a single sum. Feeds order book style depth displays in the client.computeSwapStepToken0at tick boundaries, so cumulative notional over any region prefix reproducessimulateTakerSwapExactto the wei.Tests
walkPoolDepthinvariant suite against the V4Quoter-anchored mainnet fixture: per-side totals equalmaxFillablePerpDeltaexactly (MAX_LONG/MAX_SHORT); every prefix's cumulative USD matchessimulateTakerSwapExactto the wei; contiguous outward region bounds; active-liquidity consistency.pnpm run cigreen locally (build + 304 unit tests + tsc + lint).pnpm run test:integrationgreen against live Arbitrum mainnet (41 tests incl. the V4Quoter differential).Part of the order book panel plan (perpcity-client
thoughts/shared/plans/2026-07-24-order-book-panel.md, Phase 1).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Chores