Skip to content

feat(contracts/ci/docs): property testing, fuzz targets, runbooks, WASM size tracking#1007

Open
Fidelis900 wants to merge 4 commits into
solutions-plug:mainfrom
Fidelis900:feat/issues-998-999-1000-1001
Open

feat(contracts/ci/docs): property testing, fuzz targets, runbooks, WASM size tracking#1007
Fidelis900 wants to merge 4 commits into
solutions-plug:mainfrom
Fidelis900:feat/issues-998-999-1000-1001

Conversation

@Fidelis900

Copy link
Copy Markdown
Contributor

Summary

This PR resolves four issues across contract testing, operational docs, and CI
transparency in a single branch.


#999 — Property-based invariant testing + INVARIANTS.md

  • Added proptest as a dev-dependency to contracts/predict-iq/Cargo.toml
  • Created src/modules/property_invariants_test.rs with 5 proptest properties:
    • Prop 1 — Stake conservation holds after arbitrary bet sequences
    • Prop 2 — Cancelled status is terminal; new bets are rejected
    • Prop 3 — Resolved status is terminal; new bets are rejected
    • Prop 4 — total_staked is never negative
    • Prop 5 — Full cancel + refund drains total_staked to zero
  • Created contracts/predict-iq/INVARIANTS.md documenting all 7 financial and
    state-machine invariants with Certora Prover and KEVM exploration guidance

#1000 — cargo-fuzz targets for top 3 entry points

  • Created contracts/predict-iq/fuzz/ with a proper cargo-fuzz Cargo.toml
  • Three libFuzzer targets:
    • fuzz_place_bet — fuzz outcome, amount, and timestamp inputs
    • fuzz_resolve_market — fuzz market ID and winning outcome (including out-of-range)
    • fuzz_withdraw — fuzz market ID on a cancelled market
  • Added contract-fuzz CI job to .github/workflows/test.yml:
    • Runs each target for 60 seconds with -max_total_time=60
    • Uploads crash artifacts on failure
  • Documented fuzzing setup, targets, corpus/crash handling, and CI in
    contracts/predict-iq/README.md#Fuzzing

#1001 — Operational runbooks for incident response

Five new runbooks under docs/runbooks/:

File Scenario
api-outage.md API completely unreachable — ECS checks, ALB triage, force redeploy
redis-failure.md ElastiCache down — failover, memory/connection diagnostics
email-queue-backup.md SQS queue depth spike — worker restart, DLQ inspection and replay
stellar-rpc-unavailable.md RPC unreachable — fallback switch, ledger lag measurement
ecs-task-crash-loop.md Task crash-loop — exit code guide, rollback playbook

Each runbook covers: detection signals, immediate mitigation, investigation
steps, escalation path, and post-incident actions.

Five new Prometheus alert rules added to performance/config/alerts.yaml
(APIOutage, RedisFailure, EmailQueueBackup, StellarRPCUnavailable,
ECSTaskCrashLoop) each with a runbook_url annotation.


#998 — WASM binary size budget transparency

  • Added "Print unoptimized WASM size" step to the build-optimized CI job
    so the raw pre-optimization size is logged on every build alongside the
    enforced optimized-size check (existing WASM_SIZE_LIMIT_BYTES = 65536)
  • Added WASM Size Tracking table to CHANGELOG.md [Unreleased] section
    with budget rationale and measurement instructions for contributors

Note: The 64 KB budget and WASM_SIZE_LIMIT_BYTES reference were already
documented in contracts/predict-iq/README.md prior to this PR.


Closes

Closes #999
Closes #1000
Closes #1001
Closes #998

Fidelis900 and others added 4 commits June 27, 2026 17:19
…olutions-plug#999)

- Add proptest dev-dependency to predict-iq Cargo.toml
- Add property_invariants_test.rs with 5 proptest properties covering stake
  conservation, state-machine irreversibility, and non-negative stakes
- Create INVARIANTS.md documenting all financial and state-machine invariants
  with Certora/KEVM formal verification guidance

Closes solutions-plug#999

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ions-plug#1000)

- Add fuzz/ directory with Cargo.toml and three libFuzzer targets:
  fuzz_place_bet, fuzz_resolve_market, fuzz_withdraw
- Add contract-fuzz CI job to test.yml running each target for 60 s with
  crash artifact upload on failure
- Document fuzzing setup, targets, corpus handling, and CI in README.md

Closes solutions-plug#1000

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…utions-plug#1001)

- api-outage.md: API completely unreachable — ECS checks, force redeploy, ALB triage
- redis-failure.md: ElastiCache down — failover steps, memory/connection diagnostics
- email-queue-backup.md: SQS queue depth spike — worker restart, DLQ inspection, replay
- stellar-rpc-unavailable.md: RPC unavailable — fallback endpoint switch, ledger lag check
- ecs-task-crash-loop.md: Task exits immediately — exit code guide, rollback steps
- Add corresponding Prometheus alert rules with runbook_url annotations to alerts.yaml

Closes solutions-plug#1001

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…NGELOG (solutions-plug#998)

- Add 'Print unoptimized WASM size' step to build-optimized CI job so the
  size trend is visible on every push, not just when the limit is exceeded
- Add WASM size tracking table to CHANGELOG.md [Unreleased] section with
  a note on budget rationale and measurement instructions

The 65,536-byte (64 KB) budget and its rationale were already documented in
contracts/predict-iq/README.md (WASM_SIZE_LIMIT_BYTES env var reference).

Closes solutions-plug#998

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Fidelis900 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant