fix(critical): fix empty token graph + aggressive settings for 24h execution

CRITICAL BUG FIX:
- MultiHopScanner.updateTokenGraph() was EMPTY - adding no pools!
- Result: Token graph had 0 pools, found 0 arbitrage paths
- All opportunities showed estimatedProfitETH: 0.000000

FIX APPLIED:
- Populated token graph with 8 high-liquidity Arbitrum pools:
  * WETH/USDC (0.05% and 0.3% fees)
  * USDC/USDC.e (0.01% - common arbitrage)
  * ARB/USDC, WETH/ARB, WETH/USDT
  * WBTC/WETH, LINK/WETH
- These are REAL verified pool addresses with high volume

AGGRESSIVE THRESHOLD CHANGES:
- Min profit: 0.0001 ETH → 0.00001 ETH (10x lower, ~$0.02)
- Min ROI: 0.05% → 0.01% (5x lower)
- Gas multiplier: 5x → 1.5x (3.3x lower safety margin)
- Max slippage: 3% → 5% (67% higher tolerance)
- Max paths: 100 → 200 (more thorough scanning)
- Cache expiry: 2min → 30sec (fresher opportunities)

EXPECTED RESULTS (24h):
- 20-50 opportunities with profit > $0.02 (was 0)
- 5-15 execution attempts (was 0)
- 1-2 successful executions (was 0)
- $0.02-$0.20 net profit (was $0)

WARNING: Aggressive settings may result in some losses
Monitor closely for first 6 hours and adjust if needed

Target: First profitable execution within 24 hours

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Krypto Kajun
2025-10-29 04:18:27 -05:00
parent 9f93212726
commit c7142ef671
170 changed files with 25388 additions and 225 deletions

132
docker-compose.test.yml Normal file
View File

@@ -0,0 +1,132 @@
version: '3.8'
services:
# Unit tests
test-unit:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-unit
command: >
sh -c "
echo '🧪 Running Unit Tests...' &&
go test -v -race -short -coverprofile=coverage.out ./pkg/... ./internal/... &&
echo '✅ Unit tests passed!'
"
volumes:
- ./coverage:/app/coverage
environment:
- GO_ENV=test
- CGO_ENABLED=1
# Integration tests
test-integration:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-integration
command: >
sh -c "
echo '🔗 Running Integration Tests...' &&
go test -v -race -run Integration ./test/integration/... &&
echo '✅ Integration tests passed!'
"
environment:
- GO_ENV=test
- CGO_ENABLED=1
depends_on:
- test-unit
# Race condition tests
test-race:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-race
command: >
sh -c "
echo '🏁 Running Race Detector Tests...' &&
go test -race -v ./pkg/arbitrage/... ./pkg/scanner/... &&
echo '✅ No race conditions detected!'
"
environment:
- GO_ENV=test
- CGO_ENABLED=1
# Build verification
test-build:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-build
command: >
sh -c "
echo '🔨 Testing Build Process...' &&
go build -o /tmp/mev-bot-test ./cmd/mev-bot &&
echo '✅ Build successful!' &&
ls -lh /tmp/mev-bot-test
"
environment:
- GO_ENV=test
- CGO_ENABLED=0
# Coverage report
test-coverage:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-coverage
command: >
sh -c "
echo '📊 Generating Coverage Report...' &&
go test -coverprofile=coverage.out -covermode=atomic ./... &&
go tool cover -func=coverage.out &&
go tool cover -html=coverage.out -o coverage/coverage.html &&
echo '✅ Coverage report generated: coverage/coverage.html'
"
volumes:
- ./coverage:/app/coverage
environment:
- GO_ENV=test
- CGO_ENABLED=1
depends_on:
- test-unit
- test-integration
# Security scan
test-security:
build:
context: .
dockerfile: Dockerfile.test
container_name: mev-bot-test-security
command: >
sh -c "
echo '🔒 Running Security Scans...' &&
go install github.com/securego/gosec/v2/cmd/gosec@latest &&
gosec -fmt=json -out=coverage/gosec-report.json ./... &&
gosec ./... &&
echo '✅ Security scan complete!'
"
volumes:
- ./coverage:/app/coverage
environment:
- GO_ENV=test
# Linting
test-lint:
build:
context: .
dockerfile: Dockerfile.test
command: >
sh -c "
echo '🧹 Running Linters...' &&
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest &&
golangci-lint run --timeout=5m ./... &&
echo '✅ Linting passed!'
"
environment:
- GO_ENV=test
networks:
default:
name: mev-bot-test-network