[Security] Formal Invariant Property Testing & Fuzzing Harness for Economic Solvency
Maintainer thường phản hồi trong vòng 7 ngày
@aabolari đang làm issue này rồi.
Từ ngày 29/9/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Overview & Background
Smart contracts escrowing user assets must satisfy strict mathematical invariants regardless of sequence ordering, arbitrary timestamps, rate modifications, or extreme token amounts. While standard unit tests cover nominal paths, edge-case rounding errors or balance accounting bugs can lead to protocol insolvency (where the contract's actual token balance is less than the cumulative claimable debt owed to stream recipients).
Detailed Problem Statement
- Complex Interleaved State Machine:
- Complex lifecycle permutations (e.g.
create->pause->top_up->cliff_pass->partial_withdraw->resume->cancel) may introduce rounding drift or state inconsistencies.
- Complex lifecycle permutations (e.g.
- Integer Truncation & Stroop Precision:
- Integer division in
rate_per_secondaccrual calculations can accumulate 1-stroop discrepancies over millions of seconds.
- Integer division in
Technical Specification & Architecture
1. Invariants to Mathematically Prove
Implement in contracts/stream_contract/src/property_tests.rs:
- Contract Solvency Invariant:
$$\text{Contract Balance} \ge \sum_{i \in \text{ActiveStreams}} (\text{Deposited}_i - \text{Withdrawn}_i)$$ - Zero-Sum Completion Invariant:
When a stream completes, $\text{Deposited} == \text{Withdrawn}$, with zero stranded dust remaining. - Monotonic Claimability Invariant:
For any stream without top-up, $\text{Claimable}(t_2) \ge \text{Claimable}(t_1)$ for all $t_2 \ge t_1$. - Cliff Protection Invariant:
For all ledger timestamps $t < \text{cliff_time}$, $\text{Claimable}(t) \equiv 0$.
2. Stateful Fuzzing Runner (proptest)
- Executes 20,000 generated sequences with randomized action selections, amounts up to $10^{18}$, rates, and ledger timestamp increments.
- Asserts all four invariants after every single state mutation.
Target Files
contracts/stream_contract/src/property_tests.rscontracts/stream_contract/Cargo.toml
Acceptance Criteria
- Property test suite executes 20,000 iterations without panicking or violating invariants.
- Catches potential integer overflow or negative claimable amounts under adversarial inputs.
- Added to continuous integration pipeline (
cargo test).
- Ngôn ngữ chính
- TypeScript
- Star
- 18
- Fork
- 250
- Merge trung bình
- 5 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 82
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của LabsCrypt/flowfi
-
backend points: 150 testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 7 ngày
-
backend points: 150 testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 7 ngày
-
backend points: 150 testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 7 ngày
-
backend points: 150 testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 7 ngày
-
backend points: 150 testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 7 ngày
Tất cả issue của LabsCrypt/flowfi
Issue tương tự
-
bug hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
libredb/libredb-studio#1941 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore other
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
alastair-smith/card-games#308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
paperclipai/paperclip#17379 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Đang mởcommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
lingdojo/kana-dojo#33040 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug mobile ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày