#!/usr/bin/env bash # Run E2E flow tasks in Full Parallel mode (by wave). # Ref: docs/00-meta/TASKS_TO_INCREASE_ALL_E2E_FLOWS.md # Usage: # ./scripts/run-e2e-flow-tasks-full-parallel.sh # run all waves (automated parts) # ./scripts/run-e2e-flow-tasks-full-parallel.sh --dry-run # print only / validate # ./scripts/run-e2e-flow-tasks-full-parallel.sh --wave E1 # run only wave E1 set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$REPO_ROOT" DRY_RUN="" WAVE_FILTER="" while [[ $# -gt 0 ]]; do case "$1" in --dry-run) DRY_RUN=1; shift ;; --wave) WAVE_FILTER="$2"; shift 2 ;; *) shift ;; esac done SMOM="${REPO_ROOT}/smom-dbis-138" LOG_DIR="/tmp/e2e-full-parallel-$(date +%Y%m%d-%H%M%S)" mkdir -p "$LOG_DIR" log() { echo "[$(date +%H:%M:%S)] $*"; } run_wave() { local w="$1" if [[ -n "$WAVE_FILTER" && "$w" != "$WAVE_FILTER" ]]; then return 1; fi log "=== Wave $w ===" return 0 } # ----- E0: Gates (operator only — print checklist) ----- run_e0() { run_wave "E0" || return 0 log "E0 (Operator): Ensure X1 RPC 2101 writable, X6 TransactionMirror deployed, X7 deployer funded on 138 and destinations, A1 Core RPC reachable." log " See: docs/03-deployment/RPC_2101_READONLY_FIX.md, health-check-rpc-2101.sh, ADDRESS_MATRIX_AND_STATUS.md" if [[ -n "$DRY_RUN" ]]; then return 0; fi # Optional: run health check if script exists if [[ -f "$REPO_ROOT/scripts/health/check-rpc-vms-health.sh" ]]; then ( "$REPO_ROOT/scripts/health/check-rpc-vms-health.sh" 2>&1 | tee "$LOG_DIR/e0-health.log" ) || true fi } # ----- E1: Flow A — PMM pools Chain 138 (parallel inside Phase 1) ----- run_e1() { run_wave "E1" || return 0 if [[ ! -d "$SMOM" ]]; then log "Skip E1: smom-dbis-138 not found"; return 0; fi if [[ -n "$DRY_RUN" ]]; then log "[DRY RUN] Would run: cd smom-dbis-138 && ./scripts/deployment/run-pmm-full-parity-all-phases.sh (RUN_PHASE2=0)" return 0 fi ( cd "$SMOM" && RUN_PHASE2=0 ./scripts/deployment/run-pmm-full-parity-all-phases.sh 2>&1 | tee "$LOG_DIR/e1-pmm-phase1.log" ) || true } # ----- E2: Flow B — CCIP config + fund bridges (per-chain parallel) ----- run_e2() { run_wave "E2" || return 0 if [[ ! -d "$SMOM" ]]; then log "Skip E2: smom-dbis-138 not found"; return 0; fi if [[ -n "$DRY_RUN" ]]; then log "[DRY RUN] Would run: complete-config-ready-chains.sh, fund-ccip-bridges-with-link.sh" return 0 fi ( cd "$SMOM" && ./scripts/deployment/complete-config-ready-chains.sh 2>&1 | tee "$LOG_DIR/e2-config.log" ) || true ( cd "$SMOM" && ./scripts/deployment/fund-ccip-bridges-with-link.sh 2>&1 | tee "$LOG_DIR/e2-fund.log" ) || true } # ----- E3: Code/config — token-aggregation env, bridge routes, token list ----- run_e3() { run_wave "E3" || return 0 log "E3: Ensure .env has CHAIN_138_DODO_PMM_INTEGRATION, BRIDGE_REGISTRY_ADDRESS (see smom-dbis-138/env.additions.example)." if [[ -f "$SMOM/.env" ]]; then if grep -q "CHAIN_138_DODO_PMM_INTEGRATION" "$SMOM/.env" 2>/dev/null; then log " CHAIN_138_DODO_PMM_INTEGRATION already set in .env" else log " Add CHAIN_138_DODO_PMM_INTEGRATION to smom-dbis-138/.env (copy from env.additions.example)" fi if grep -q "BRIDGE_REGISTRY_ADDRESS" "$SMOM/.env" 2>/dev/null; then log " BRIDGE_REGISTRY_ADDRESS already set in .env" else log " Add BRIDGE_REGISTRY_ADDRESS for Flow C quote API (orchestration)" fi fi if [[ -n "$DRY_RUN" ]]; then return 0; fi # Validation that can run from anywhere if [[ -f "$REPO_ROOT/scripts/validation/validate-config-files.sh" ]]; then ( "$REPO_ROOT/scripts/validation/validate-config-files.sh" 2>&1 | tee "$LOG_DIR/e3-validate.log" ) || true fi } # ----- E4: Infra/verify (operator/LAN) ----- run_e4() { run_wave "E4" || return 0 log "E4 (Operator/LAN): X2 Blockscout verify, X3 E2E routing, X4 Explorer E2E, X5 token-aggregation health." log " run-contract-verification-with-proxy.sh, verify-end-to-end-routing.sh, explorer e2e-test-explorer.sh" if [[ -n "$DRY_RUN" ]]; then return 0; fi if [[ -f "$REPO_ROOT/scripts/verify/verify-end-to-end-routing.sh" ]]; then ( "$REPO_ROOT/scripts/verify/verify-end-to-end-routing.sh" 2>&1 | tee "$LOG_DIR/e4-routing.log" ) || true fi } # ----- E5: Multichain — PMM Phase 2 (parallel per chain) ----- run_e5() { run_wave "E5" || return 0 if [[ ! -d "$SMOM" ]]; then log "Skip E5: smom-dbis-138 not found"; return 0; fi if [[ -n "$DRY_RUN" ]]; then log "[DRY RUN] Would run: run-pmm-full-parity-all-phases.sh (RUN_PHASE1=0) for L2s" return 0 fi ( cd "$SMOM" && RUN_PHASE1=0 ./scripts/deployment/run-pmm-full-parity-all-phases.sh 2>&1 | tee "$LOG_DIR/e5-pmm-phase2.log" ) || true } # ----- E6: Frontend + test (code/operator) ----- run_e6() { run_wave "E6" || return 0 log "E6: B6 Bridge UI to routes+token mapping; B7 test 138↔dest; C5–C7 destination DEX, full path quote UI, E2E test." log " See TASKS_TO_INCREASE_ALL_E2E_FLOWS.md Flow B/C." } # ----- E7: Docs ----- run_e7() { run_wave "E7" || return 0 log "E7: Update docs/11-references/PMM_DEX_ROUTING_STATUS.md when pools/liquidity live; runbooks in DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER, CONFIG_READY_CHAINS." if [[ -n "$DRY_RUN" ]]; then return 0; fi # No automated doc edit; operator updates when state changes } # ----- Run waves (E1+E2+E3 can run in parallel; E5 after E1 if both run) ----- log "E2E Full Parallel — DRY_RUN=$DRY_RUN WAVE_FILTER=$WAVE_FILTER Logs: $LOG_DIR" run_e0 # E1 and E2 are independent; E3 is config check — run E1 and E2 in parallel when not dry-run if [[ -z "$DRY_RUN" && -z "$WAVE_FILTER" ]]; then run_e1 & P1=$! run_e2 & P2=$! run_e3 wait "$P1" 2>/dev/null || true wait "$P2" 2>/dev/null || true else run_e1 run_e2 run_e3 fi run_e4 run_e5 run_e6 run_e7 log "Done. Logs in $LOG_DIR"