- 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>
67 lines
1.8 KiB
Go
67 lines
1.8 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/fraktal/mev-beta/tools/math-audit/internal/audit"
|
|
"github.com/fraktal/mev-beta/tools/math-audit/internal/checks"
|
|
"github.com/fraktal/mev-beta/tools/math-audit/internal/loader"
|
|
"github.com/fraktal/mev-beta/tools/math-audit/internal/report"
|
|
)
|
|
|
|
var (
|
|
vectorsFlag = flag.String("vectors", "default", "Vector set to load (default, path, or comma-separated list)")
|
|
reportDir = flag.String("report", "", "Optional directory to write JSON and Markdown reports")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
log.SetFlags(0)
|
|
|
|
vectors, err := loader.LoadVectors(*vectorsFlag)
|
|
if err != nil {
|
|
log.Fatalf("load vectors: %v", err)
|
|
}
|
|
|
|
if len(vectors) == 0 {
|
|
log.Fatalf("no vectors loaded from selector %q", *vectorsFlag)
|
|
}
|
|
|
|
runner := audit.NewRunner()
|
|
propertyChecks := checks.Run()
|
|
result := runner.Run(vectors, propertyChecks)
|
|
|
|
failed := (result.Summary.VectorsPassed != result.Summary.TotalVectors) ||
|
|
(result.Summary.AssertionsPassed != result.Summary.TotalAssertions) ||
|
|
(result.Summary.PropertySucceeded != result.Summary.PropertyChecks)
|
|
|
|
fmt.Printf("Math audit completed: %d/%d vectors passed, %d/%d assertions passed, %d/%d property checks succeeded\n",
|
|
result.Summary.VectorsPassed,
|
|
result.Summary.TotalVectors,
|
|
result.Summary.AssertionsPassed,
|
|
result.Summary.TotalAssertions,
|
|
result.Summary.PropertySucceeded,
|
|
result.Summary.PropertyChecks,
|
|
)
|
|
|
|
if *reportDir != "" {
|
|
jsonPath, err := report.WriteJSON(*reportDir, result)
|
|
if err != nil {
|
|
log.Fatalf("write json report: %v", err)
|
|
}
|
|
mdPath, err := report.WriteMarkdown(*reportDir, result)
|
|
if err != nil {
|
|
log.Fatalf("write markdown report: %v", err)
|
|
}
|
|
fmt.Printf("Reports written to %s and %s\n", jsonPath, mdPath)
|
|
}
|
|
|
|
if failed {
|
|
os.Exit(1)
|
|
}
|
|
}
|