chore(contracts): add contract docs, deployment & verification scripts, and formal verification helpers#911
Conversation
…s, and formal verification helpers Closes Devsol-01#875, Devsol-01#883, Devsol-01#882, Devsol-01#874
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@OtowoSamuel 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! 🚀 |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an operational workflow around the Soroban contracts (docs, deployment manifests, verification/rollback helpers) and embeds key Markdown references into the contract crate documentation.
Changes:
- Embed contract reference/ops/verification docs into crate-level rustdoc.
- Introduce bash scripts for flattening sources, generating docs, creating deployment manifests, and verifying recorded deployments.
- Add ops and formal-verification documentation (and commit generated outputs).
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/src/lib.rs | Includes ops/reference/verification Markdown in crate rustdoc. |
| contracts/scripts/common.sh | Shared helpers and paths for ops scripts. |
| contracts/scripts/deploy.sh | Builds WASM and writes a deployment manifest with hashes. |
| contracts/scripts/flatten-source.sh | Produces deterministic flattened source bundle + per-file hash manifest. |
| contracts/scripts/verify.sh | Verifies current source/WASM hash against latest manifest. |
| contracts/scripts/status.sh | Prints the latest deployment manifest. |
| contracts/scripts/rollback.sh | Prints a rollback target manifest (operator redeploy helper). |
| contracts/scripts/generate-docs.sh | Assembles a single documentation bundle from multiple Markdown files. |
| contracts/scripts/run-formal-checks.sh | Runs cargo tests and writes a verification report. |
| contracts/scripts/README.md | Documents how to use the new scripts. |
| contracts/docs/CONTRACT_OPERATIONS.md | Documents deployment/verification/rollback workflow. |
| contracts/docs/FORMAL_VERIFICATION.md | Documents invariants and proof obligations. |
| contracts/docs/generated/contract-documentation.md | Generated documentation bundle committed to repo. |
| contracts/docs/generated/verification-report.md | Generated verification report (currently shows failing tests). |
| contracts/README.md | Links to ops docs and scripts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| log "Building contract WASM" | ||
| cargo build --manifest-path "$CONTRACTS_ROOT/Cargo.toml" --target wasm32-unknown-unknown --release | ||
|
|
||
| wasm_path=$(find "$CONTRACTS_ROOT/target/wasm32-unknown-unknown/release" -maxdepth 1 -name '*.wasm' -type f | sort | tail -n 1) |
| timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ) | ||
|
|
||
| manifest_dir="$DEPLOYMENT_ROOT/$network" | ||
| manifest_path="$manifest_dir/$timestamp.json" |
| manifest_source_hash=$(grep -o '"source_sha256": "[^"]*"' "$latest" | head -n 1 | cut -d '"' -f 4) | ||
| manifest_wasm_hash=$(grep -o '"wasm_sha256": "[^"]*"' "$latest" | head -n 1 | cut -d '"' -f 4) | ||
| manifest_wasm_path=$(grep -o '"wasm_path": "[^"]*"' "$latest" | head -n 1 | cut -d '"' -f 4) |
|
|
||
| log "Running contract unit tests (focused on invariants and critical flows)" | ||
|
|
||
| if cargo test --manifest-path "$CONTRACTS_ROOT/Cargo.toml" --lib -- --nocapture; then |
This PR adds comprehensive contract documentation, operational scripts for building, flattening, deploying, verifying, and a smoke formal-verification helper.
Files added/updated:
contracts/src/lib.rsThis change provides a repeatable workflow for generating NatSpec-style documentation, creating a flattened source bundle for on-chain verification, and running smoke verification/test reports. It does not change contract logic.
Closes #875, Closes #883, Closes #882, Closes #874