Files
mev-beta/.github/workflows/ci.yml
Krypto Kajun 850223a953 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>
2025-10-17 00:12:55 -05:00

223 lines
6.4 KiB
YAML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Staging Pipeline
on:
workflow_dispatch:
inputs:
run_live_integration:
description: 'Run live RPC-dependent integration tests'
required: false
default: 'false'
workflow_call:
env:
GO_VERSION: '1.25'
jobs:
staging-test:
name: Build, Lint & Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Cache Go toolchain
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-staging-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-staging-${{ env.GO_VERSION }}-
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=10m
- name: Run go vet
run: go vet ./...
- name: Run unit tests (race + coverage)
run: |
export SKIP_LIVE_RPC_TESTS=true
export USE_MOCK_RPC=true
GOCACHE=$(pwd)/.gocache go test -race -coverprofile=coverage.out ./...
- name: Upload coverage
uses: actions/upload-artifact@v3
with:
name: staging-coverage
path: coverage.out
- name: Build binary
run: go build -v -o mev-bot ./cmd/mev-bot
- name: Smoke start binary
run: |
export MEV_BOT_ENCRYPTION_KEY="test_key_32_chars_minimum_length"
timeout 5s ./mev-bot start || true
echo "✓ Binary builds and starts successfully"
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: staging-test
if: vars.ENABLE_LIVE_INTEGRATION == 'true' || (github.event_name == 'workflow_dispatch' && github.event.inputs.run_live_integration == 'true')
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Restore Go cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-staging-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-staging-${{ env.GO_VERSION }}-
- name: Run integration tests
run: |
export ARBITRUM_RPC_ENDPOINT="mock://localhost:8545"
export ARBITRUM_WS_ENDPOINT="mock://localhost:8546"
export SKIP_LIVE_RPC_TESTS=true
go test -v ./pkg/monitor/ -tags=integration
go test -v ./pkg/arbitrage/ -tags=integration
go test -v ./pkg/arbitrum/ -tags=integration
- name: Performance benchmarks
run: |
go test -bench=. -benchmem ./pkg/monitor/
go test -bench=. -benchmem ./pkg/scanner/
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [staging-test, integration-test]
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
push: false
tags: mev-bot:staging
cache-from: type=gha
cache-to: type=gha,mode=max
math-audit:
name: Math Audit
runs-on: ubuntu-latest
needs: staging-test
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Restore Go cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-staging-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-staging-${{ env.GO_VERSION }}-
- name: Run math audit
run: GOCACHE=$(pwd)/.gocache go run ./tools/math-audit --vectors default --report reports/math/latest
- name: Verify math audit artifacts
run: |
test -s reports/math/latest/report.json
test -s reports/math/latest/report.md
- name: Upload math audit report
uses: actions/upload-artifact@v3
with:
name: math-audit-report
path: reports/math/latest
deployment-ready:
name: Deployment Ready Check
runs-on: ubuntu-latest
needs: [staging-test, integration-test, docker-build, math-audit]
if: always()
steps:
- name: Check deployment readiness
run: |
integration_result="${{ needs.integration-test.result }}"
if [[ "$integration_result" == "skipped" ]]; then
echo " Integration tests skipped (live RPC disabled)."
integration_result="success"
echo "INTEGRATION_STATUS=skipped (RPC disabled)" >> $GITHUB_ENV
else
echo "INTEGRATION_STATUS=${{ needs.integration-test.result }}" >> $GITHUB_ENV
fi
if [[ "${{ needs.staging-test.result }}" == "success" && "$integration_result" == "success" && "${{ needs.math-audit.result }}" == "success" ]]; then
echo "✅ All tests passed - Ready for deployment"
echo "DEPLOYMENT_READY=true" >> $GITHUB_ENV
else
echo "❌ Tests failed - Not ready for deployment"
echo "DEPLOYMENT_READY=false" >> $GITHUB_ENV
exit 1
fi
- name: Generate deployment summary
run: |
cat > deployment-summary.md << 'EOF'
# 🚀 MEV Bot Staging Summary
**Commit**: ${{ github.sha }}
**Branch**: ${{ github.ref_name }}
**Timestamp**: $(date -u)
## Test Results
- **Build & Unit**: ${{ needs.staging-test.result }}
- **Integration Tests**: ${INTEGRATION_STATUS:-${{ needs.integration-test.result }}}
- **Docker Build**: ${{ needs.docker-build.result }}
- **Math Audit**: ${{ needs.math-audit.result }}
## Reports
- Math Audit: reports/math/latest/report.md (artifact **math-audit-report**)
## Deployment Notes
- Ensure RPC endpoints are configured
- Set strong encryption key (32+ chars)
- Configure rate limits appropriately
- Monitor transaction processing metrics
EOF
- name: Upload deployment summary
uses: actions/upload-artifact@v3
with:
name: staging-deployment-summary
path: deployment-summary.md