- Added comprehensive bounds checking to prevent buffer overruns in multicall parsing - Implemented graduated validation system (Strict/Moderate/Permissive) to reduce false positives - Added LRU caching system for address validation with 10-minute TTL - Enhanced ABI decoder with missing Universal Router and Arbitrum-specific DEX signatures - Fixed duplicate function declarations and import conflicts across multiple files - Added error recovery mechanisms with multiple fallback strategies - Updated tests to handle new validation behavior for suspicious addresses - Fixed parser test expectations for improved validation system - Applied gofmt formatting fixes to ensure code style compliance - Fixed mutex copying issues in monitoring package by introducing MetricsSnapshot - Resolved critical security vulnerabilities in heuristic address extraction - Progress: Updated TODO audit from 10% to 35% complete 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
2.1 KiB
Go
66 lines
2.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/fraktal/mev-beta/tools/exchange-audit/internal"
|
|
)
|
|
|
|
func main() {
|
|
var (
|
|
exchanges = flag.String("exchanges", "uniswap_v2,uniswap_v3,curve,balancer", "Comma-separated list of exchanges to audit")
|
|
network = flag.String("network", "arbitrum", "Network to audit (arbitrum, ethereum)")
|
|
outputDir = flag.String("output", "reports/exchange-audit", "Output directory")
|
|
verbose = flag.Bool("verbose", false, "Enable verbose output")
|
|
deepCheck = flag.Bool("deep", false, "Perform deep integration checks")
|
|
connectivity = flag.Bool("connectivity", true, "Check exchange connectivity")
|
|
contracts = flag.Bool("contracts", true, "Validate contract addresses")
|
|
apis = flag.Bool("apis", true, "Test API endpoints")
|
|
integration = flag.Bool("integration", true, "Test integration completeness")
|
|
timeout = flag.Duration("timeout", 5*time.Minute, "Timeout for audit operations")
|
|
)
|
|
flag.Parse()
|
|
|
|
// Create output directory
|
|
if err := os.MkdirAll(*outputDir, 0755); err != nil {
|
|
log.Fatalf("Failed to create output directory: %v", err)
|
|
}
|
|
|
|
// Initialize exchange auditor
|
|
auditor, err := internal.NewExchangeAuditor(&internal.ExchangeAuditConfig{
|
|
Exchanges: *exchanges,
|
|
Network: *network,
|
|
OutputDir: *outputDir,
|
|
Verbose: *verbose,
|
|
DeepCheck: *deepCheck,
|
|
CheckConnectivity: *connectivity,
|
|
CheckContracts: *contracts,
|
|
CheckAPIs: *apis,
|
|
CheckIntegration: *integration,
|
|
Timeout: *timeout,
|
|
})
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize exchange auditor: %v", err)
|
|
}
|
|
|
|
ctx := context.Background()
|
|
ctx, cancel := context.WithTimeout(ctx, *timeout)
|
|
defer cancel()
|
|
|
|
fmt.Printf("Starting exchange integration audit for %s network...\n", *network)
|
|
if err := auditor.AuditExchanges(ctx); err != nil {
|
|
log.Fatalf("Exchange audit failed: %v", err)
|
|
}
|
|
|
|
if err := auditor.GenerateReport(); err != nil {
|
|
log.Fatalf("Report generation failed: %v", err)
|
|
}
|
|
|
|
fmt.Printf("Exchange audit complete. Reports saved to: %s\n", *outputDir)
|
|
}
|