Skip to content

Merge pull request #1035 from kaynaomi-oss/feature/883-geo-block-poli… #1

Merge pull request #1035 from kaynaomi-oss/feature/883-geo-block-poli…

Merge pull request #1035 from kaynaomi-oss/feature/883-geo-block-poli… #1

Workflow file for this run

name: Contract Fuzz
on:
push:
branches:
- main
paths:
- 'contracts/niffyinsure/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/contract-fuzz.yml'
pull_request:
branches:
- main
paths:
- 'contracts/niffyinsure/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/contract-fuzz.yml'
# Allow manual runs with a custom time budget
workflow_dispatch:
inputs:
fuzz_seconds:
description: 'Fuzz time budget per target (seconds)'
required: false
default: '60'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Default time budget per target in CI (30 s is enough to catch shallow bugs).
FUZZ_SECONDS: ${{ github.event.inputs.fuzz_seconds || '30' }}
jobs:
fuzz:
name: Fuzz contract entrypoints
runs-on: ubuntu-latest
defaults:
run:
working-directory: contracts/niffyinsure
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # stable
with:
toolchain: nightly
components: rust-src
- name: Cache Rust build artifacts
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: |
~/.cargo/registry
~/.cargo/git
target/
key: ${{ runner.os }}-fuzz-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-fuzz-
- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked
- name: Fuzz fuzz_file_claim
run: |
cargo fuzz run fuzz_file_claim \
fuzz/corpus/fuzz_file_claim \
-- -max_total_time=${{ env.FUZZ_SECONDS }} -max_len=512
continue-on-error: false
- name: Fuzz fuzz_initiate_policy
run: |
cargo fuzz run fuzz_initiate_policy \
fuzz/corpus/fuzz_initiate_policy \
-- -max_total_time=${{ env.FUZZ_SECONDS }} -max_len=512
continue-on-error: false
- name: Fuzz fuzz_finalize_claim
run: |
cargo fuzz run fuzz_finalize_claim \
fuzz/corpus/fuzz_finalize_claim \
-- -max_total_time=${{ env.FUZZ_SECONDS }} -max_len=64
continue-on-error: false
- name: Upload crash artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: fuzz-crashes-${{ github.sha }}
path: |
contracts/niffyinsure/fuzz/artifacts/
retention-days: 30