Skip to content

Wiring diagram + state-machine documentation for the four frozen/upgrade/permission edges #15

Description

@P3az3

Problem Statement

The codebase has these mutating entrypoints: initialize, donate, end_campaign, cancel_campaign, extend_deadline, release_milestone, release_milestone_multi_asset, claim_refund, freeze, unfreeze, upgrade. Each has its own auth, freeze, status, and reentrancy posture. There is no single document that maps out: "When the contract is X, who can do Y?".

Why it matters

Internal docs (in docs/events.md, code comments) cover individual entrypoints but lack a unified matrix. New contributors and security auditors have to read every function signature to reconstruct the model. A matrix-style table is the difference between 30 minutes and 3 minutes of audit time.

Expected Outcome

A new docs/state-machine.md that contains:

  • A 2D table with fields: row = entrypoint; columns = "auth required", "freeze gates writes?", "status gate", "reentrancy lock acquired?", "mutates storage?", "emits events?", "events emitted".
  • A state diagram (Mermaid or similar) showing all transitions.
  • A freeze module documentation with the ordering invariant (freeze-before-auth).
  • A "post-upgrade contract migration" checklist for upgrade events.

Acceptance Criteria

  • docs/state-machine.md exists and is referenced from README.md.
  • Each entrypoint row in the table is verified by at least one existing test name.
  • The state diagram is valid Mermaid that renders correctly in GitHub preview.
  • Inline /// doc comments on each entrypoint reference this doc.

Implementation Notes

  • Place in docs/state-machine.md next to events.md and deployment.md.
  • Use a markdown table — GitHub renders it nicely.
  • Reference existing issue numbers for ownership.

Affected Files / Modules

  • docs/state-machine.md (new)
  • README.md (link)
  • campaign/src/lib.rs (doc-comment cross-references)

Dependencies — None.

Activity

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

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26architectureCross-cutting structural design choice.documentationImprovements or additions to documentationpriority/p2Should-do in current quarter.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions