54 lines
1.7 KiB
Markdown
54 lines
1.7 KiB
Markdown
# Verify Mathematical Precision
|
|
|
|
Verify the precision and correctness of the following mathematical implementation in the MEV bot: $ARGUMENTS
|
|
|
|
## Verification Protocol:
|
|
|
|
### 1. **Mathematical Correctness Analysis**
|
|
- Review mathematical formulas against official specifications
|
|
- Validate implementation against known test cases
|
|
- Check boundary conditions and edge cases
|
|
- Verify precision handling for large numbers
|
|
|
|
### 2. **Property-Based Testing**
|
|
```bash
|
|
# Run property-based tests for mathematical functions
|
|
go test -v -run=Property ./pkg/uniswap/...
|
|
|
|
# Run fuzz tests for mathematical calculations
|
|
go test -fuzz=Fuzz ./pkg/uniswap/...
|
|
```
|
|
|
|
### 3. **Precision Validation Areas**
|
|
|
|
#### **Uniswap V3 Calculations**
|
|
- sqrtPriceX96 to price conversion accuracy
|
|
- Tick calculation correctness
|
|
- Liquidity-based calculation precision
|
|
- Price impact computation validation
|
|
|
|
#### **Financial Calculations**
|
|
- Profit calculation accuracy
|
|
- Gas estimation precision
|
|
- Slippage protection validation
|
|
- Fee calculation correctness
|
|
|
|
### 4. **Comparison Testing**
|
|
- Compare results with reference implementations
|
|
- Validate against on-chain data when possible
|
|
- Cross-check with other DeFi protocol implementations
|
|
- Benchmark against established mathematical libraries
|
|
|
|
## Verification Steps:
|
|
1. **Static Analysis**: Review code for mathematical correctness
|
|
2. **Unit Testing**: Verify with known test cases
|
|
3. **Property Testing**: Test mathematical invariants
|
|
4. **Fuzz Testing**: Find edge cases with random inputs
|
|
5. **Comparison Testing**: Validate against reference implementations
|
|
|
|
## Output Requirements:
|
|
- Detailed correctness analysis report
|
|
- Precision validation results
|
|
- Edge case identification and handling
|
|
- Recommendations for improvements
|
|
- Test suite enhancements |