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>
This commit is contained in:
@@ -11,10 +11,19 @@ import (
|
||||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/ethclient"
|
||||
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
"github.com/fraktal/mev-beta/pkg/validation"
|
||||
)
|
||||
|
||||
// safeConvertInt64ToUint64 safely converts an int64 to uint64, ensuring no negative values
|
||||
func safeConvertInt64ToUint64(v int64) uint64 {
|
||||
if v < 0 {
|
||||
return 0
|
||||
}
|
||||
return uint64(v)
|
||||
}
|
||||
|
||||
// SlippageProtection provides comprehensive slippage protection for trades
|
||||
type SlippageProtection struct {
|
||||
validator *validation.InputValidator
|
||||
@@ -345,7 +354,7 @@ func (sp *SlippageProtection) CreateSafeTradeParameters(
|
||||
minAmountOutInt, _ := minAmountOut.Int(nil)
|
||||
|
||||
// Set deadline to 5 minutes from now
|
||||
deadline := uint64(time.Now().Add(5 * time.Minute).Unix())
|
||||
deadline := safeConvertInt64ToUint64(time.Now().Add(5 * time.Minute).Unix())
|
||||
|
||||
return &TradeParameters{
|
||||
TokenIn: tokenIn,
|
||||
|
||||
Reference in New Issue
Block a user