Skip to content

Formal verification of share accounting math #672

Description

@robertocarlous

Description

Perform formal verification of the vault's share accounting math using a proof assistant or model checker to mathematically prove correctness properties.

Use Case

Share accounting is the core economic mechanism. Bugs here could lead to fund loss. Formal verification provides the highest level of assurance.

Properties to Verify

  • TotalShares never exceeds sum of all user shares
  • No user share balance can go negative
  • Exchange rate is monotonically non-decreasing (with yield)
  • Deposit/withdrawal round-trip preserves value within rounding tolerance
  • Rounding always favors the vault (never the user)

Acceptance Criteria

  • Property specification document
  • Kani model checker proofs for key properties
  • Automated proof runs in CI
  • All properties pass on current codebase
  • Proof maintenance process for code changes
  • Document properties and proofs in docs/FORMAL_VERIFICATION.md

Technical Notes

  • Kani is well-suited for Rust formal verification
  • Build on existing property tests as specification

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programsecuritySecurity hardening, audit prep, incident response

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions