Files
mev-beta/pkg/arbitrage/decimal_helpers_test.go
Krypto Kajun 850223a953 fix(multicall): resolve critical multicall parsing corruption issues
- 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>
2025-10-17 00:12:55 -05:00

39 lines
836 B
Go

package arbitrage
import (
"math/big"
"testing"
"github.com/fraktal/mev-beta/pkg/math"
)
func TestEthAmountStringPrefersDecimalSnapshot(t *testing.T) {
ud, err := math.NewUniversalDecimal(big.NewInt(1500000000000000000), 18, "ETH")
if err != nil {
t.Fatalf("unexpected error creating decimal: %v", err)
}
got := ethAmountString(nil, ud, nil)
if got != "1.500000" {
t.Fatalf("expected 1.500000, got %s", got)
}
}
func TestEthAmountStringFallsBackToWei(t *testing.T) {
wei := big.NewInt(123450000000000000)
got := ethAmountString(nil, nil, wei)
if got != "0.123450" {
t.Fatalf("expected 0.123450, got %s", got)
}
}
func TestGweiAmountStringFormatsTwoDecimals(t *testing.T) {
wei := big.NewInt(987654321)
got := gweiAmountString(nil, nil, wei)
if got != "0.99" {
t.Fatalf("expected 0.99, got %s", got)
}
}