harb/onchain/testing_todos.md
johba 400ab325ed refactor: Complete project renaming from HARB/Harberger to KRAIKEN
- Updated all production code references from 'harb' to 'kraiken'
- Changed 'Harberger tax' references to 'self-assessed tax'
- Updated function names (_getHarbToken -> _getKraikenToken)
- Modified documentation and comments to reflect new branding
- Updated token symbol from HARB to KRAIKEN in tests
- Maintained backward compatibility with test variable names

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 11:05:08 +02:00

4.3 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 COMPLETED via cleanup
    • Duplicate functionality removed - VWAPTracker.t.sol already contains proper assertion-based double overflow tests
    • Eliminated VWAPDoubleOverflowAnalysis.t.sol entirely - 100% duplicate of VWAPTracker.t.sol
    • Proper tests with assertions already exist: testDoubleOverflowExtremeEthPriceScenario(), testDoubleOverflowHyperinflatedHarbScenario(), testDoubleOverflowMaximumTransactionScenario()

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

Code Organization Improvements COMPLETED

  • DELETE VWAPDoubleOverflowAnalysis.t.sol - 100% duplicate functionality COMPLETED
  • RENAME ModularComponentsTest.t.sol → CompilationValidation.t.sol COMPLETED
  • All tests verified passing after cleanup COMPLETED

Progress Summary

  • Completed: 4/15 tasks (27%) + 3 cleanup tasks
  • High Priority Remaining: 1/6 tasks (testExtremeExpensiveHarbHandling - doesn't exist)
  • 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, KRAIKEN at $1
  • testDoubleOverflowHyperinflatedHarbScenario() - KRAIKEN 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.