64 lines
2.1 KiB
TOML
64 lines
2.1 KiB
TOML
name = "verify-precision"
|
|
description = "Verify Mathematical Precision - Verify the precision and correctness of mathematical implementations"
|
|
category = "verification"
|
|
parameters = [
|
|
{ name = "implementation", type = "string", description = "The mathematical implementation to verify" }
|
|
]
|
|
|
|
[command]
|
|
shell = '''
|
|
echo "# Verify Mathematical Precision
|
|
|
|
Verify the precision and correctness of the following mathematical implementation in the MEV bot: ${implementation}
|
|
|
|
## 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"
|
|
''' |