- 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>
47 lines
1.3 KiB
Go
47 lines
1.3 KiB
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestComputeSummaryDefaultVectors(t *testing.T) {
|
|
dataset, err := loadVectors("vectors/default.json")
|
|
if err != nil {
|
|
t.Fatalf("loadVectors: %v", err)
|
|
}
|
|
|
|
summary, err := computeSummary("vectors/default.json", dataset)
|
|
if err != nil {
|
|
t.Fatalf("computeSummary: %v", err)
|
|
}
|
|
|
|
if summary.Attempts != 5 {
|
|
t.Fatalf("expected 5 attempts, got %d", summary.Attempts)
|
|
}
|
|
if summary.Executed != 4 {
|
|
t.Fatalf("expected 4 executed, got %d", summary.Executed)
|
|
}
|
|
if summary.Successful != 3 {
|
|
t.Fatalf("expected 3 successful, got %d", summary.Successful)
|
|
}
|
|
if summary.Failed != 1 {
|
|
t.Fatalf("expected 1 failed, got %d", summary.Failed)
|
|
}
|
|
if summary.GrossProfitETH != "0.101000" {
|
|
t.Fatalf("gross profit mismatch: %s", summary.GrossProfitETH)
|
|
}
|
|
if summary.GasCostETH != "0.013700" {
|
|
t.Fatalf("gas cost mismatch: %s", summary.GasCostETH)
|
|
}
|
|
if summary.NetProfitETH != "0.087300" {
|
|
t.Fatalf("net profit mismatch: %s", summary.NetProfitETH)
|
|
}
|
|
if summary.AverageProfitETH != "0.021825" {
|
|
t.Fatalf("avg profit mismatch: %s", summary.AverageProfitETH)
|
|
}
|
|
if summary.AverageGasCostETH != "0.003425" {
|
|
t.Fatalf("avg gas mismatch: %s", summary.AverageGasCostETH)
|
|
}
|
|
if len(summary.ExchangeBreakdown) != 3 {
|
|
t.Fatalf("expected 3 exchanges, got %d", len(summary.ExchangeBreakdown))
|
|
}
|
|
}
|