chore(ai): add comprehensive CLI configurations for all AI assistants

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Krypto Kajun
2025-09-14 10:09:55 -05:00
parent 2c4f663728
commit a410f637cd
34 changed files with 2391 additions and 5 deletions

View File

@@ -0,0 +1,34 @@
# Implement Mathematical Algorithm
Implement the following mathematical algorithm for the MEV bot: $ARGUMENTS
## Implementation Framework:
1. **Requirements Analysis**: Break down the mathematical requirements and precision needs
2. **Formula Implementation**: Convert mathematical formulas to precise Go code
3. **Precision Handling**: Use appropriate data types (uint256, big.Int) for calculations
4. **Edge Case Handling**: Consider boundary conditions and error scenarios
5. **Testing**: Create comprehensive tests including property-based tests
6. **Optimization**: Optimize for performance while maintaining precision
## Implementation Standards:
- **Numerical Precision**: Use github.com/holiman/uint256 for precise uint256 arithmetic
- **Error Handling**: Implement robust error handling with clear error messages
- **Documentation**: Document all mathematical formulas and implementation decisions
- **Testing**: Achieve >95% test coverage with property-based tests for mathematical functions
- **Performance**: Consider performance implications and benchmark critical paths
## File Organization:
- **Core Logic**: Place in appropriate `pkg/uniswap/` or `pkg/math/` subdirectory
- **Tests**: Co-locate with source files (`*_test.go`)
- **Documentation**: Inline comments explaining mathematical formulas
## Integration Points:
- **Uniswap Pricing**: Integrate with `pkg/uniswap/` for pricing calculations
- **Market Analysis**: Connect to `pkg/market/` for market data processing
- **Precision Libraries**: Use `github.com/holiman/uint256` for uint256 arithmetic
## Deliverables:
- Working implementation with comprehensive tests
- Documentation of mathematical formulas and implementation approach
- Performance benchmarks for critical functions
- Edge case handling and error scenarios

View File

@@ -0,0 +1,65 @@
# Optimize Mathematical Performance
Optimize the performance of the following mathematical function in the MEV bot: $ARGUMENTS
## Performance Optimization Strategy:
### 1. **Profiling and Measurement**
```bash
# CPU profiling for mathematical functions
go tool pprof http://localhost:9090/debug/pprof/profile?seconds=30
# Memory profiling for mathematical calculations
go tool pprof http://localhost:9090/debug/pprof/heap
# Benchmark testing for mathematical functions
go test -bench=. -benchmem ./pkg/uniswap/...
```
### 2. **Optimization Areas**
#### **Precision Handling Optimization**
- Uint256 arithmetic optimization
- Object pooling for frequent calculations
- Minimize memory allocations in hot paths
- Efficient conversion between data types
#### **Algorithm Optimization**
- Mathematical formula simplification
- Lookup table implementation for repeated calculations
- Caching strategies for expensive computations
- Parallel processing opportunities
#### **Memory Optimization**
- Pre-allocation of slices and buffers
- Object pooling for mathematical objects
- Minimize garbage collection pressure
- Efficient data structure selection
### 3. **MEV Bot Specific Optimizations**
#### **Uniswap V3 Pricing Functions**
- sqrtPriceX96 to price conversion optimization
- Tick calculation performance improvements
- Liquidity-based calculation efficiency
- Price impact computation optimization
#### **Arbitrage Calculations**
- Profit calculation optimization
- Cross-pool comparison performance
- Gas estimation accuracy and speed
- Multi-hop arbitrage efficiency
## Implementation Guidelines:
- Measure before optimizing (baseline metrics)
- Focus on bottlenecks identified through profiling
- Maintain mathematical precision while improving performance
- Add performance tests for regressions
- Document optimization strategies and results
## Deliverables:
- Performance benchmark results (before/after)
- Optimized code with maintained precision
- Performance monitoring enhancements
- Optimization documentation
- Regression test suite

View File

@@ -0,0 +1,54 @@
# 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