|
| 1 | +# Tornado-SVM GitHub Actions Workflows |
| 2 | + |
| 3 | +## Build Workflow |
| 4 | + |
| 5 | +### Workflow: `build.yml` |
| 6 | + |
| 7 | +**Purpose:** Build, test, and validate the Tornado-SVM codebase using the Bun JavaScript runtime and Solana build tools. |
| 8 | + |
| 9 | +### Trigger Methods: |
| 10 | + |
| 11 | +1. **On Push:** Runs on all branch pushes and version tags |
| 12 | +2. **On Pull Request:** Runs on all pull requests |
| 13 | + |
| 14 | +### What the Workflow Does: |
| 15 | + |
| 16 | +1. Sets up Bun and Rust toolchains |
| 17 | +2. Installs Solana build tools |
| 18 | +3. Builds the Solana program using Cargo build-sbf |
| 19 | +4. Runs program tests |
| 20 | +5. Lints the code with Clippy |
| 21 | +6. Builds and tests the client |
| 22 | + |
| 23 | +### Technologies Used: |
| 24 | + |
| 25 | +- **Bun:** Fast JavaScript runtime and package manager |
| 26 | +- **Rust:** Primary language for the Solana program |
| 27 | +- **Solana CLI:** For building and testing Solana programs |
| 28 | + |
| 29 | +### Solana CLI Installation |
| 30 | + |
| 31 | +The workflow automatically installs the Solana CLI using the following process: |
| 32 | + |
| 33 | +```bash |
| 34 | +# Install Solana CLI tools |
| 35 | +sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)" |
| 36 | + |
| 37 | +# Add to GitHub Actions PATH |
| 38 | +echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH |
| 39 | + |
| 40 | +# Also add to current shell session |
| 41 | +export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" |
| 42 | +``` |
| 43 | + |
| 44 | +This ensures that the Solana binaries are available for all steps in the workflow that require them. |
| 45 | + |
| 46 | +## Testnet Transaction Metrics Workflow |
| 47 | + |
| 48 | +This workflow automates the process of running Tornado-SVM privacy solution transactions on Solana testnet and generating comprehensive metrics reports. |
| 49 | + |
| 50 | +### Workflow: `tornado_testnet_transaction.yml` |
| 51 | + |
| 52 | +**Purpose:** Execute the complete Tornado-SVM transaction flow on Solana testnet and collect detailed performance metrics. |
| 53 | + |
| 54 | +### Trigger Methods: |
| 55 | + |
| 56 | +1. **Manual Trigger:** Run the workflow on-demand via GitHub UI with configurable parameters |
| 57 | +2. **Scheduled Runs:** Automatically runs weekly on Sundays at midnight UTC |
| 58 | +3. **Pull Request Trigger:** Runs on PRs to the master branch that modify core files |
| 59 | + |
| 60 | +### Configurable Parameters: |
| 61 | + |
| 62 | +- **Denomination:** Amount of SOL to use in the transaction (default: 1 SOL) |
| 63 | +- **Merkle Tree Height:** Height of the Merkle tree for the Tornado instance (default: 20) |
| 64 | +- **RPC URL:** Custom Solana RPC URL (defaults to testnet) |
| 65 | + |
| 66 | +### What the Workflow Does: |
| 67 | + |
| 68 | +1. Sets up Bun runtime and the Solana toolchain |
| 69 | +2. Creates a new Solana wallet and requests an airdrop |
| 70 | +3. Deploys the Tornado-SVM program to the Solana testnet |
| 71 | +4. Initializes a new Tornado instance |
| 72 | +5. Performs a complete deposit and withdrawal flow with zkSNARK proofs |
| 73 | +6. Captures detailed metrics at each step including: |
| 74 | + - Execution times for each phase |
| 75 | + - Transaction signatures |
| 76 | + - Compute unit consumption |
| 77 | + - Gas fees |
| 78 | + - Transaction details |
| 79 | +7. Generates a comprehensive markdown report with visualizations |
| 80 | +8. Creates a GitHub job summary |
| 81 | +9. Uploads all reports and raw metrics as artifacts |
| 82 | + |
| 83 | +### Artifacts Generated: |
| 84 | + |
| 85 | +- **transaction_report.md:** Complete markdown report with all metrics and visualizations |
| 86 | +- **metrics/*.json:** Raw JSON data for transaction details |
| 87 | +- **metrics/execution_times.txt:** Detailed timing measurements for each phase |
| 88 | + |
| 89 | +### Using the Report: |
| 90 | + |
| 91 | +1. Download the artifact from the completed workflow run |
| 92 | +2. Open the markdown report to view all metrics and visualizations |
| 93 | +3. The report includes: |
| 94 | + - Executive summary |
| 95 | + - Configuration details |
| 96 | + - Transaction logs |
| 97 | + - Detailed metrics for each transaction |
| 98 | + - Explorer links for all on-chain activity |
| 99 | + - Visualizations of the transaction flow and zkSNARK process |
| 100 | + - Solana network stats during the test |
| 101 | + |
| 102 | +### Example Usage |
| 103 | + |
| 104 | +To manually trigger the workflow with custom parameters: |
| 105 | + |
| 106 | +1. Go to the "Actions" tab in the GitHub repository |
| 107 | +2. Select "Tornado SVM Testnet Transaction Test" workflow |
| 108 | +3. Click "Run workflow" |
| 109 | +4. Enter your desired parameters (denomination, Merkle tree height, RPC URL) |
| 110 | +5. Click "Run workflow" |
| 111 | +6. Once completed, download the artifacts from the workflow run |
| 112 | + |
| 113 | +### Troubleshooting |
| 114 | + |
| 115 | +#### Solana CLI Not Found |
| 116 | + |
| 117 | +If you encounter the error `solana: command not found`, check the following: |
| 118 | + |
| 119 | +1. Verify that the Solana CLI installation step completed successfully |
| 120 | +2. The workflow now adds Solana binaries to GitHub's persistent PATH variable (`$GITHUB_PATH`), ensuring all subsequent steps can access the commands |
| 121 | +3. We also add `$HOME/.cargo/bin` to PATH to pick up cargo-build-sbf and cargo-test-sbf |
| 122 | +4. The workflow no longer needs explicit PATH exports in each step |
| 123 | +5. The transaction script has robust error handling to provide detailed diagnostic information when Solana is not found |
| 124 | +6. You can use the `SOLANA_PATH` environment variable to override the default Solana binary location |
| 125 | + |
| 126 | +#### Cargo Lock File Version Compatibility |
| 127 | + |
| 128 | +If you encounter Cargo lock file version compatibility issues: |
| 129 | + |
| 130 | +1. The workflow now explicitly updates Cargo to the latest stable version |
| 131 | +2. We've added a specific step that runs `rustup update stable` and `rustup default stable` |
| 132 | +3. Cargo version is explicitly checked and logged for troubleshooting |
| 133 | +4. The workflow now intelligently checks if the installed Cargo version is compatible with Cargo.lock version 4: |
| 134 | + ```bash |
| 135 | + CARGO_VERSION=$(cargo --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') |
| 136 | + MAJOR=$(echo "$CARGO_VERSION" | cut -d'.' -f1) |
| 137 | + MINOR=$(echo "$CARGO_VERSION" | cut -d'.' -f2) |
| 138 | + if [ "$MAJOR" -lt 1 ] || ([ "$MAJOR" -eq 1 ] && [ "$MINOR" -lt 70 ]); then |
| 139 | + # If Cargo is too old, upgrade it again |
| 140 | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable --profile minimal |
| 141 | + fi |
| 142 | + ``` |
| 143 | +5. The workflow automatically regenerates the Cargo.lock file to ensure it uses a format compatible with the current Cargo version |
| 144 | +6. After regeneration, it explicitly verifies the lock file format with `grep -q 'version = 4' Cargo.lock` |
| 145 | +7. Any existing Cargo.lock is deleted and freshly regenerated to avoid format conflicts |
| 146 | +8. Detailed debugging output is provided if the Cargo.lock generation fails |
| 147 | + |
| 148 | +#### Build Command Not Found |
| 149 | + |
| 150 | +If you encounter errors with `cargo build-sbf` or `cargo build-bpf`: |
| 151 | + |
| 152 | +1. The workflow now checks if commands are available using `help` flags |
| 153 | +2. It tries both SBF (newer) and BPF (older) variants |
| 154 | +3. If needed, it runs `solana-install update` to get the latest build tools |
| 155 | +4. PATH is updated to include all possible locations for Cargo and Solana binaries |
| 156 | + |
| 157 | +#### Notifications |
| 158 | + |
| 159 | +The workflow previously used Telegram for notifications, which has been replaced with: |
| 160 | + |
| 161 | +1. Console-based logging for better workflow compatibility |
| 162 | +2. No external dependencies or tokens required |
| 163 | +3. Clear notification messages in the workflow logs |
0 commit comments