Skip to content

Conversation

@filipmacek
Copy link
Member

Pull Request

This change aligns PoolProfiler::process_collect with Uniswap V3's actual behavior by removing tick validation for collect events.

Problem

The profiler was validating ticks in process_collect, causing it to fail on legitimate on-chain collect events with invalid or edge-case tick values (e.g., tick_lower == tick_upper). This validation doesn't exist in Uniswap V3's collect function
because invalid positions never accumulate fees to collect.

Example transaction that caused the error:
https://arbiscan.io/tx/0x9d8d8511ea136be6758bf7cdfb71e18297ebfc54273552c7c4ddf2c8e40387e2#eventlog#31

Error logs:

2025-10-01T14:22:43.640Z INFO  [nautilus_cli::blockchain::analyze] Profiling pool events from database...
2025-10-01T14:22:55.636Z ERROR [nautilus] Error executing Nautilus CLI: Invalid tick range: 0 >= 0

Solution

  • Removed validate_ticks() call from process_collect
  • Changed behavior to silently return Ok(()) when position doesn't exist (instead of throwing error)
  • Updated documentation to explain why tick validation is intentionally skipped
  • Added test case verifying collect with invalid ticks doesn't panic and leaves valid positions unchanged

Why This Is Correct

In Uniswap V3, the collect function doesn't validate tick ranges because:

  1. Positions with invalid ticks can never accumulate fees
  2. The function safely returns zero fees for non-existent positions
  3. Validation adds unnecessary overhead for a non-issue

This change makes the profiler more resilient when processing real-world blockchain data that may contain edge cases.

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Breaking change (impacts existing behavior)
  • Documentation update
  • Maintenance / chore

Testing

Ensure new or changed logic is covered by tests.

  • Affected code paths are already covered by the test suite
  • I added/updated tests to cover new or changed logic

@filipmacek filipmacek requested a review from cjdsellers October 1, 2025 18:36
@filipmacek filipmacek self-assigned this Oct 1, 2025
@filipmacek filipmacek added bug Something isn't working rust Relating to the Rust core labels Oct 1, 2025
@filipmacek filipmacek changed the title Remove tick validaiton in collect processing for pool profiler Remove tick validation in collect processing for pool profiler Oct 1, 2025
@cjdsellers cjdsellers merged commit cb10c27 into develop Oct 1, 2025
17 checks passed
@cjdsellers cjdsellers deleted the pool-profiler-collect-invalid-tick-fix branch October 1, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working rust Relating to the Rust core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants