[Security] Formal Invariant Property Testing & Fuzzing Harness for Economic Solvency
メンテナーはふだん 7 日以内に返信
@aabolari がすでに取り組んでいます。
2026年9月29日 から。
評価
この issue はまだ評価されていません。
説明
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).
- 主要言語
- TypeScript
- スター
- 18
- フォーク
- 250
- 平均マージ
- 5日 6時間
- マージ済み PR(30日)
- 82
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
LabsCrypt/flowfi のほかの issue
-
backend points: 150 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 7 日以内に返信
-
backend points: 150 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 7 日以内に返信
-
backend points: 150 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 7 日以内に返信
-
backend points: 150 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 7 日以内に返信
-
backend points: 150 testing
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 7 日以内に返信
LabsCrypt/flowfi の issue をすべて見る
似ている issue
-
level/task type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
wazuh/wazuh-dashboard-plugins#9508 ·
メンテナーはふだん 1 日以内に返信
-
Testnet EOL page links Zonescan mainnet対応中かも @napelvs が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Azure-Samples/azure-search-openai-demo#3249 ·
メンテナーはふだん 1 日以内に返信
-
[Docs] docs/architecture.mermaid leaves out 21 of the 51 src/ directories対応中かも @uyg7x が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
enhancement status:needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dongdongbh/Mindwtr#1438 ·
メンテナーはふだん 1 日以内に返信