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:
@@ -8,9 +8,10 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
|
||||
"github.com/fraktal/mev-beta/internal/config"
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
// Database represents the database connection and operations
|
||||
@@ -155,6 +156,8 @@ func (d *Database) initSchema() error {
|
||||
amount1_in TEXT NOT NULL,
|
||||
amount0_out TEXT NOT NULL,
|
||||
amount1_out TEXT NOT NULL,
|
||||
sender TEXT NOT NULL,
|
||||
recipient TEXT NOT NULL,
|
||||
amount_in_usd REAL NOT NULL,
|
||||
amount_out_usd REAL NOT NULL,
|
||||
fee_usd REAL NOT NULL,
|
||||
@@ -162,6 +165,7 @@ func (d *Database) initSchema() error {
|
||||
sqrt_price_x96 TEXT NOT NULL,
|
||||
liquidity TEXT NOT NULL,
|
||||
tick INTEGER NOT NULL,
|
||||
fee INTEGER NOT NULL,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)`); err != nil {
|
||||
return fmt.Errorf("failed to create swap_events table: %w", err)
|
||||
|
||||
@@ -6,10 +6,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/fraktal/mev-beta/internal/config"
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/fraktal/mev-beta/internal/config"
|
||||
"github.com/fraktal/mev-beta/internal/logger"
|
||||
)
|
||||
|
||||
func TestDatabaseOperations(t *testing.T) {
|
||||
@@ -40,7 +41,7 @@ func TestDatabaseOperations(t *testing.T) {
|
||||
Amount1In: big.NewInt(0),
|
||||
Amount0Out: big.NewInt(0),
|
||||
Amount1Out: big.NewInt(500000000000000000), // 0.5 WETH
|
||||
Owner: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
|
||||
Sender: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
|
||||
Recipient: common.HexToAddress("0x8765432109fedcba8765432109fedcba87654321"),
|
||||
Protocol: "uniswap_v3",
|
||||
}
|
||||
@@ -59,8 +60,6 @@ func TestDatabaseOperations(t *testing.T) {
|
||||
Liquidity: big.NewInt(1000000000000000000), // 1 ETH equivalent
|
||||
Amount0: big.NewInt(2000000000), // 2000 USDC
|
||||
Amount1: big.NewInt(1000000000000000000), // 1 WETH
|
||||
Owner: common.HexToAddress("0x1234567890abcdef1234567890abcdef12345678"),
|
||||
Recipient: common.HexToAddress("0x8765432109fedcba8765432109fedcba87654321"),
|
||||
EventType: "add",
|
||||
Protocol: "uniswap_v3",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user