Deploy hardened SubscriptionManager to Base Sepolia (0x3116...B033) #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| solidity-tests: | |
| name: Solidity Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run forge test | |
| working-directory: contracts | |
| run: forge test | |
| formal-verification: | |
| name: Counterflow Formal Verification | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - name: Install Z3 | |
| run: pip install z3-solver | |
| - name: Counterflow — ValuePacket pool-level proofs | |
| working-directory: veros-verify | |
| run: | | |
| node src/cli.js check valuepacket/bindings/PaymentChannel.binding.json | |
| node src/cli.js check valuepacket/bindings/CrossChainSettlement.binding.json | |
| node src/cli.js check valuepacket/bindings/SubscriptionManager.binding.json | |
| node src/cli.js audit | |
| typescript-build: | |
| name: TypeScript Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Install workspace dependencies | |
| run: npm install | |
| - name: Build SDK | |
| working-directory: sdk | |
| run: npm run build | |
| - name: Build CLI | |
| working-directory: cli | |
| run: npm run build | |
| typescript-tests: | |
| name: TypeScript Tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - typescript-build | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - uses: foundry-rs/foundry-toolchain@v1 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Install workspace dependencies | |
| run: npm install | |
| - name: Build SDK | |
| working-directory: sdk | |
| run: npm run build | |
| - name: SDK tests | |
| working-directory: sdk | |
| run: npx vitest run | |
| - name: CLI tests | |
| working-directory: cli | |
| run: npx vitest run | |
| happy-path-integration: | |
| name: Happy-Path Integration | |
| runs-on: ubuntu-latest | |
| needs: | |
| - solidity-tests | |
| - typescript-build | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - uses: foundry-rs/foundry-toolchain@v1 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Install workspace dependencies | |
| run: npm install | |
| - name: Build SDK | |
| working-directory: sdk | |
| run: npm run build | |
| - name: Start anvil | |
| run: | | |
| anvil --host 0.0.0.0 --port 8545 --chain-id 31337 > /tmp/anvil.log 2>&1 & | |
| echo "Waiting for anvil..." | |
| for _ in $(seq 1 30); do | |
| if curl -s -X POST -H "Content-Type: application/json" \ | |
| -d '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ | |
| http://localhost:8545 > /dev/null 2>&1; then | |
| echo "Anvil is ready" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Anvil failed to start" | |
| cat /tmp/anvil.log | |
| exit 1 | |
| - name: Deploy contracts | |
| working-directory: contracts | |
| run: | | |
| mkdir -p deployments | |
| forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast 2>&1 | tee /tmp/forge-output.txt | |
| - name: Parse deployed addresses | |
| run: | | |
| MOCK_USDC=$(sed -nE 's/.*MOCK_USDC=\s*(0x[a-fA-F0-9]{40}).*/\1/p' /tmp/forge-output.txt | head -1) | |
| PAYMENT_CHANNEL=$(sed -nE 's/.*PAYMENT_CHANNEL=\s*(0x[a-fA-F0-9]{40}).*/\1/p' /tmp/forge-output.txt | head -1) | |
| SERVICE_REGISTRY=$(sed -nE 's/.*SERVICE_REGISTRY=\s*(0x[a-fA-F0-9]{40}).*/\1/p' /tmp/forge-output.txt | head -1) | |
| SPENDING_POLICY=$(sed -nE 's/.*SPENDING_POLICY=\s*(0x[a-fA-F0-9]{40}).*/\1/p' /tmp/forge-output.txt | head -1) | |
| CHAIN_ID=$(sed -nE 's/.*CHAIN_ID=\s*([0-9]+).*/\1/p' /tmp/forge-output.txt | head -1) | |
| cat > contracts/deployments/local.json <<JSONEOF | |
| { | |
| "chainId": $CHAIN_ID, | |
| "mockUSDC": "$MOCK_USDC", | |
| "paymentChannel": "$PAYMENT_CHANNEL", | |
| "serviceRegistry": "$SERVICE_REGISTRY", | |
| "spendingPolicy": "$SPENDING_POLICY" | |
| } | |
| JSONEOF | |
| echo "USDC_ADDRESS=$MOCK_USDC" >> "$GITHUB_ENV" | |
| echo "PAYMENT_CHANNEL_ADDRESS=$PAYMENT_CHANNEL" >> "$GITHUB_ENV" | |
| echo "=== deployments/local.json ===" | |
| cat contracts/deployments/local.json | |
| - name: Start price-feed server | |
| working-directory: services/price-feed | |
| env: | |
| CHAIN: local | |
| RPC_URL: http://localhost:8545 | |
| run: | | |
| npx tsx src/server.ts > /tmp/price-feed.log 2>&1 & | |
| echo "Waiting for price-feed server..." | |
| for _ in $(seq 1 30); do | |
| if curl -s http://localhost:3000/health 2>/dev/null | grep -q '"ok"'; then | |
| echo "Price-feed server is ready" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Price-feed server failed to start" | |
| echo "=== server log ===" | |
| cat /tmp/price-feed.log | |
| exit 1 | |
| - name: Run happy-path harness | |
| working-directory: services/price-feed | |
| env: | |
| PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" | |
| PAYEE_PRIVATE_KEY: "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" | |
| RPC_URL: http://localhost:8545 | |
| BASE_URL: http://localhost:3000 | |
| run: node scripts/happy-path.mjs | |
| workspace-build: | |
| name: Workspace Build | |
| runs-on: ubuntu-latest | |
| needs: | |
| - typescript-build | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Install workspace dependencies | |
| run: npm install | |
| - name: Build all workspaces | |
| run: npm run build --workspaces --if-present | |
| - name: Indexer typecheck | |
| working-directory: indexer | |
| run: npx ponder codegen && npx tsc --noEmit | |
| services-tests: | |
| name: Service Tests | |
| runs-on: ubuntu-latest | |
| needs: | |
| - typescript-build | |
| continue-on-error: true # network-dependent (external price APIs); non-blocking until external calls are stubbed — see issues | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - uses: foundry-rs/foundry-toolchain@v1 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22 | |
| - name: Install workspace dependencies | |
| run: npm install | |
| - name: Build SDK | |
| working-directory: sdk | |
| run: npm run build | |
| - name: Install standalone service dependencies | |
| run: | | |
| npm install --prefix services/contract-audit | |
| npm install --prefix services/mev-scanner | |
| npm install --prefix services/reputation | |
| - name: Test price-feed (workspace) | |
| working-directory: services/price-feed | |
| run: npx vitest run --maxWorkers=2 | |
| - name: Test contract-audit (standalone) | |
| working-directory: services/contract-audit | |
| run: npx vitest run --maxWorkers=2 | |
| - name: Test mev-scanner (standalone) | |
| working-directory: services/mev-scanner | |
| run: npx vitest run --maxWorkers=2 | |
| - name: Test reputation (standalone) | |
| working-directory: services/reputation | |
| run: npx vitest run --maxWorkers=2 | |
| coverage: | |
| name: Solidity Coverage | |
| runs-on: ubuntu-latest | |
| continue-on-error: true # pre-existing test failure in SubscriptionManager; coverage report generated successfully (80.46% line) | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| - uses: foundry-rs/foundry-toolchain@v1 | |
| - name: Run forge coverage | |
| working-directory: contracts | |
| run: forge coverage --ir-minimum --report summary --report lcov | |
| - name: Upload lcov artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-lcov | |
| path: contracts/lcov.info | |
| if-no-files-found: ignore |