harb/onchain/testing_todos.md
giteadmin bab3550ebf Add position contiguity validation and VWAP recording test improvements
- Enhanced LiquidityManager test infrastructure with position contiguity checking
- Added tick range validation to Response struct and checkLiquidity() function
- Implemented proper assertions for testRecordVolumeAndPriceUnsafe() fuzzing test
- Added anchor-discovery contiguity validation for both token orderings
- Improved VWAP overflow detection testing with contract state validation
- Updated testing todos with completion status and priority analysis

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-18 22:39:22 +02:00

3.7 KiB

Testing Todo List

High Priority

  • Break down testDoubleOverflowRealisticScenario() into 3 separate tests with assertions COMPLETED
  • 🔥 CRITICAL: Create Position Dependency Order Test - verify _set() function order ANCHOR → DISCOVERY → FLOOR with correct dependencies COMPLETED
    • Implemented as anchor-discovery contiguity checking in existing test infrastructure
    • Added tick range validation to checkLiquidity() function and _validateRecenterResult()
    • Correctly handles both token orderings (WETH as token0 vs token1)
  • 🔥 NEXT CRITICAL: Add assertions to testRecordVolumeAndPriceUnsafe() - should assert recording behavior and overflow detection COMPLETED
    • Implemented proper contract interaction with before/after state validation
    • Added assertions for normal recording, compression, and extreme transaction capping
    • Validates VWAP calculation accuracy and handles different overflow scenarios
    • Now properly tests contract behavior instead of just logging calculations
  • Add assertions to testAttemptToCreateDoubleOverflow() - should assert expected overflow behavior instead of just logging
  • Add assertions to testExtremeExpensiveHarbHandling() - should assert price movements and behavior instead of relying on 'not reverting'

Medium Priority

  • Create Floor Position VWAP Exclusivity Test - prove only floor position uses VWAP, anchor/discovery use current tick
    • Moved from High Priority - VWAP exclusivity not critical as long as floor correctly uses VWAP
  • Create EthScarcity vs EthAbundance Scenarios Test - test event emission and VWAP application logic
  • Complete LiquidityManager integration tests - comprehensive test suite exercising full contract
  • Create Floor Position Discount Verification Test - verify floor position pricing uses adjusted VWAP (70% + capital inefficiency)
  • Validate gas usage equivalent to original LiquidityManager contract

Low Priority

  • Create Cross-Position Independence Test - verify anchor/discovery positions unaffected by VWAP changes
  • Convert UniswapMath to library for better reusability
  • Create interfaces for position strategies
  • Design plugin architecture for swappable position strategies
  • Add enhanced monitoring with granular events per component

Progress Summary

  • Completed: 3/15 tasks (20%)
  • High Priority Remaining: 2/6 tasks
  • Medium Priority Remaining: 5/5 tasks
  • Low Priority Remaining: 5/5 tasks

Priority Analysis (Post-Test Consolidation)

COMPLETED: Position Dependency Order Test - Successfully implemented as anchor-discovery contiguity checking COMPLETED: testRecordVolumeAndPriceUnsafe() Assertions - Now properly tests VWAP contract behavior:

  • Fuzzing test with 257 runs validates recording behavior and overflow detection
  • Asserts normal recording, compression triggers, and extreme transaction capping
  • Validates VWAP calculation accuracy across different scenarios
  • Tests actual contract interface instead of just mathematical calculations

NEXT PRIORITY: Add assertions to testAttemptToCreateDoubleOverflow() - Convert logging-only test to proper assertions

Recent Completion

Break down testDoubleOverflowRealisticScenario() - Successfully split into 3 focused tests with proper assertions:

  • testDoubleOverflowExtremeEthPriceScenario() - ETH at $1M, HARB at $1
  • testDoubleOverflowHyperinflatedHarbScenario() - HARB at $1M, ETH at $3k
  • testDoubleOverflowMaximumTransactionScenario() - 10k ETH transactions

All new tests validate that double overflow requires unrealistic conditions, proving the 1000x compression limit provides adequate protection.