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:
@@ -7,14 +7,23 @@ import (
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/holiman/uint256"
|
||||
|
||||
"github.com/fraktal/mev-beta/internal/config"
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
"github.com/fraktal/mev-beta/pkg/events"
|
||||
"github.com/fraktal/mev-beta/pkg/market"
|
||||
"github.com/fraktal/mev-beta/pkg/scanner"
|
||||
"github.com/holiman/uint256"
|
||||
)
|
||||
|
||||
// safeConvertInt64ToUint64 safely converts an int64 to uint64, ensuring no negative values
|
||||
func safeConvertInt64ToUint64(v int64) uint64 {
|
||||
if v < 0 {
|
||||
return 0
|
||||
}
|
||||
return uint64(v)
|
||||
}
|
||||
|
||||
// CreateTestConfig creates a test configuration
|
||||
func CreateTestConfig() *config.Config {
|
||||
return &config.Config{
|
||||
@@ -77,7 +86,7 @@ func CreateTestEvent() *events.Event {
|
||||
SqrtPriceX96: uint256.NewInt(2505414483750470000),
|
||||
Liquidity: uint256.NewInt(1000000000000000000),
|
||||
Tick: 200000,
|
||||
Timestamp: uint64(time.Now().Unix()),
|
||||
Timestamp: safeConvertInt64ToUint64(time.Now().Unix()),
|
||||
TransactionHash: common.HexToHash("0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"),
|
||||
BlockNumber: 12345,
|
||||
}
|
||||
@@ -102,7 +111,7 @@ func CreateTestMarketManager() *market.MarketManager {
|
||||
}
|
||||
|
||||
// CreateTestScanner creates a test market scanner
|
||||
func CreateTestScanner() *scanner.MarketScanner {
|
||||
func CreateTestScanner() *scanner.Scanner {
|
||||
cfg := &config.BotConfig{
|
||||
MaxWorkers: 5,
|
||||
ChannelBufferSize: 10,
|
||||
@@ -110,7 +119,7 @@ func CreateTestScanner() *scanner.MarketScanner {
|
||||
MinProfitThreshold: 10.0,
|
||||
}
|
||||
logger := CreateTestLogger()
|
||||
return scanner.NewMarketScanner(cfg, logger)
|
||||
return scanner.NewScanner(cfg, logger, nil, nil)
|
||||
}
|
||||
|
||||
// CreateTestPipeline creates a test pipeline
|
||||
|
||||
Reference in New Issue
Block a user