Skip to content

Improve invariants #401

Improve invariants

Improve invariants #401

Workflow file for this run

name: Test Fuzz Tests
on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'documentation/**'
- '.github/**'
branches:
- develop
- master
env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: "v3.1.8"
RUST_VERSION: "1.86"
jobs:
fuzz-tests:
name: Fuzz Tests - ${{ matrix.test.name }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
test:
- name: "Hello World"
path: "examples/hello_world"
cache-key: "hello-world"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Simple CPI"
path: "examples/cpi"
cache-key: "simple-cpi"
command: "trident fuzz run fuzz_0 -e invariants"
build: |
cargo build-sbf --manifest-path programs/callee/Cargo.toml --arch v2
cargo build-sbf --manifest-path programs/cpi/Cargo.toml --arch v2
- name: "Trident Benchmark Maze 0"
path: "examples/trident-benchmark/maze_0"
cache-key: "maze-0"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Trident Benchmark Maze 1"
path: "examples/trident-benchmark/maze_1"
cache-key: "maze-1"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Trident Benchmark Maze 2"
path: "examples/trident-benchmark/maze_2"
cache-key: "maze-2"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Trident Benchmark Maze 3"
path: "examples/trident-benchmark/maze_3"
cache-key: "maze-3"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Trident Benchmark Maze 4"
path: "examples/trident-benchmark/maze_4"
cache-key: "maze-4"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Metaplex CPI"
path: "examples/metaplex"
cache-key: "metaplex"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Token"
path: "examples/token"
cache-key: "token"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
- name: "Fork"
path: "examples/fork"
cache-key: "fork"
command: "trident fuzz run fuzz_0 -e invariants"
build: "cargo build-sbf --arch v2"
steps:
- uses: actions/checkout@v3
name: Checkout Repository
- name: Install system packages
run: sudo apt-get update && sudo apt-get install -y build-essential libudev-dev protobuf-compiler libprotobuf-dev
shell: bash
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Setup Solana
uses: ./.github/actions/setup-solana
with:
solana-version: ${{ env.SOLANA_VERSION }}
- name: Rust Cache
id: rust-cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
shared-key: "trident-fuzzing"
key: fuzz-tests-${{ runner.os }}-${{ matrix.test.cache-key }}
workspaces: |
./${{ matrix.test.path }}
./${{ matrix.test.path }}/trident-tests
- name: Install Trident
if: steps.rust-cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup-trident/
- name: Build Solana Program
working-directory: ${{ matrix.test.path }}
run: ${{ matrix.test.build }}
- name: Run Fuzz Test
working-directory: ${{ matrix.test.path }}/trident-tests
run: ${{ matrix.test.command }}
checks:
name: Fuzz Tests (Checks)
needs: fuzz-tests
runs-on: ubuntu-24.04
steps:
- run: echo "All fuzz tests completed successfully"