feat: implement adaptive log scanning for escrow transfers - #163
feat: implement adaptive log scanning for escrow transfers#163manishdex25 wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 37 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughV5 escrow transfer retrieval now uses adaptive backward log scanning with mint-event termination and ethers v5/v6 address support. Log parsing skips incompatible ABI logs. Event timestamp retrieval deduplicates block requests and limits concurrency to five workers. ChangesEscrow retrieval and timestamp processing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant fetchEscrowTransfersV5
participant fetchAllTransfers
participant scanLogsBackward
participant Provider
fetchEscrowTransfersV5->>fetchAllTransfers: pass provider and transfer data
fetchAllTransfers->>scanLogsBackward: scan escrow address to block zero
scanLogsBackward->>Provider: request adaptive eth_getLogs window
Provider-->>scanLogsBackward: return logs or range-limit error
scanLogsBackward-->>fetchAllTransfers: return logs after mint boundary
fetchAllTransfers-->>fetchEscrowTransfersV5: return parsed escrow transfers
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/core/endorsement-chain/retrieveEndorsementChain.ts (1)
21-35: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression tests for timestamp batching.
Test repeated block numbers to confirm that each block is fetched once. Test more than five unique blocks and assert that concurrent provider requests never exceed five. Also verify that timestamps remain aligned with the sorted
logChain.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/endorsement-chain/retrieveEndorsementChain.ts` around lines 21 - 35, Add regression tests around the timestamp batching logic using repeated block numbers to verify each block is fetched only once, and more than five unique blocks to verify provider concurrency never exceeds five. Assert the returned timestamps remain aligned with the sorted logChain order.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/core/endorsement-chain/fetchLogsChunked.ts`:
- Around line 9-17: Update the chunk-size constants and range-limit retry logic
in fetchLogsChunked: use 1 as the minimum request size while preserving 10 as
the free-tier maximum window size, and ensure a range-limit error still invokes
shrinkForRangeLimit when chunkSize is 10 so dense ranges can retry with smaller
windows instead of rethrowing.
- Around line 111-112: Update the chunk scanning logic around chunkGroups.push
and isMintLog to locate the latest matching mint log in chunkLogs, append only
the suffix starting at that log, then stop scanning; retain the full chunk when
no mint log is present.
---
Nitpick comments:
In `@src/core/endorsement-chain/retrieveEndorsementChain.ts`:
- Around line 21-35: Add regression tests around the timestamp batching logic
using repeated block numbers to verify each block is fetched only once, and more
than five unique blocks to verify provider concurrency never exceeds five.
Assert the returned timestamps remain aligned with the sorted logChain order.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a33ca9d8-6d3c-4f63-8db0-ab608b3d182b
📒 Files selected for processing (3)
src/core/endorsement-chain/fetchEscrowTransfer.tssrc/core/endorsement-chain/fetchLogsChunked.tssrc/core/endorsement-chain/retrieveEndorsementChain.ts
|



Summary
What is the background of this pull request?
Changes
Issues
What are the related issues or stories?
Summary by CodeRabbit