refactor: move all remaining files to orig/ directory
Completed clean root directory structure: - Root now contains only: .git, .env, docs/, orig/ - Moved all remaining files and directories to orig/: - Config files (.claude, .dockerignore, .drone.yml, etc.) - All .env variants (except active .env) - Git config (.gitconfig, .github, .gitignore, etc.) - Tool configs (.golangci.yml, .revive.toml, etc.) - Documentation (*.md files, @prompts) - Build files (Dockerfiles, Makefile, go.mod, go.sum) - Docker compose files - All source directories (scripts, tests, tools, etc.) - Runtime directories (logs, monitoring, reports) - Dependency files (node_modules, lib, cache) - Special files (--delete) - Removed empty runtime directories (bin/, data/) V2 structure is now clean: - docs/planning/ - V2 planning documents - orig/ - Complete V1 codebase preserved - .env - Active environment config (not in git) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
112
orig/scripts/run-fork-tests.sh
Executable file
112
orig/scripts/run-fork-tests.sh
Executable file
@@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to run arbitrage tests with forked Arbitrum environment
|
||||
set -e
|
||||
|
||||
echo "🚀 Starting forked Arbitrum tests..."
|
||||
|
||||
# Check if anvil is available
|
||||
if ! command -v anvil &> /dev/null; then
|
||||
echo "❌ Anvil not found. Please install Foundry first:"
|
||||
echo "curl -L https://foundry.paradigm.xyz | bash"
|
||||
echo "foundryup"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Kill any existing anvil processes
|
||||
echo "🔄 Stopping any existing anvil processes..."
|
||||
pkill -f anvil || true
|
||||
sleep 2
|
||||
|
||||
# Set up environment variables for forked network
|
||||
export ARBITRUM_RPC_ENDPOINT="https://arb1.arbitrum.io/rpc"
|
||||
export ARBITRUM_WS_ENDPOINT="ws://localhost:8545"
|
||||
export METRICS_ENABLED="false"
|
||||
export MEV_BOT_ENCRYPTION_KEY="test-fork-encryption-key-32-chars"
|
||||
export MEV_BOT_ALLOW_LOCALHOST="true"
|
||||
export TEST_WITH_FORK="true"
|
||||
|
||||
# Start anvil with Arbitrum fork
|
||||
echo "🔗 Starting anvil with Arbitrum One fork..."
|
||||
anvil \
|
||||
--fork-url "$ARBITRUM_RPC_ENDPOINT" \
|
||||
--host 0.0.0.0 \
|
||||
--port 8545 \
|
||||
--accounts 10 \
|
||||
--balance 1000 \
|
||||
--gas-limit 30000000 \
|
||||
--gas-price 100000000 \
|
||||
--block-time 1 \
|
||||
--silent &
|
||||
|
||||
ANVIL_PID=$!
|
||||
echo "📊 Anvil started with PID: $ANVIL_PID"
|
||||
|
||||
# Cleanup function
|
||||
cleanup() {
|
||||
echo "🧹 Cleaning up..."
|
||||
kill $ANVIL_PID 2>/dev/null || true
|
||||
wait $ANVIL_PID 2>/dev/null || true
|
||||
echo "✅ Cleanup completed"
|
||||
}
|
||||
|
||||
# Set up trap for cleanup
|
||||
trap cleanup EXIT
|
||||
|
||||
# Wait for anvil to be ready
|
||||
echo "⏳ Waiting for anvil to be ready..."
|
||||
sleep 5
|
||||
|
||||
# Verify anvil is running
|
||||
if ! curl -s -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
|
||||
http://localhost:8545 > /dev/null; then
|
||||
echo "❌ Anvil failed to start properly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Anvil fork ready on http://localhost:8545"
|
||||
|
||||
# Update RPC endpoint to use local fork
|
||||
export ARBITRUM_RPC_ENDPOINT="http://localhost:8545"
|
||||
|
||||
# Run the fork tests
|
||||
echo "🧪 Running arbitrage tests with forked environment..."
|
||||
|
||||
# Test 1: Security validation with fork
|
||||
echo "🔒 Testing security validation..."
|
||||
go test -v ./test/security_validation_test.go -timeout 60s
|
||||
|
||||
# Test 2: Arbitrage execution with fork
|
||||
echo "🔄 Testing arbitrage execution..."
|
||||
go test -v ./test/arbitrage_fork_test.go -timeout 120s
|
||||
|
||||
# Test 3: Build and run bot briefly
|
||||
echo "🔨 Building and testing MEV bot..."
|
||||
go build -o bin/mev-bot cmd/mev-bot/main.go
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Failed to build MEV bot"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ MEV bot built successfully"
|
||||
|
||||
# Run bot for 10 seconds to test startup
|
||||
echo "🚀 Testing bot startup..."
|
||||
timeout 10 ./bin/mev-bot start || true
|
||||
|
||||
echo "🎯 All fork tests completed successfully!"
|
||||
echo ""
|
||||
echo "📊 Test Summary:"
|
||||
echo " ✅ Security vulnerabilities fixed"
|
||||
echo " ✅ Arbitrage execution implemented"
|
||||
echo " ✅ Fork connectivity verified"
|
||||
echo " ✅ Real contract integration working"
|
||||
echo ""
|
||||
echo "🔗 Fork Details:"
|
||||
echo " URL: http://localhost:8545"
|
||||
echo " Chain ID: 42161 (Arbitrum One)"
|
||||
echo " Block: ~250M (recent state)"
|
||||
echo " Funded accounts: 10 with 1000 ETH each"
|
||||
Reference in New Issue
Block a user