closeYieldVault can leave residual FCM position due to precision/rounding
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- blockchain
- 領域
- blockchain
調査の方向性
Start at closeYieldVault and trace how the UFix64 amounts and swap quote are used to repay debt and unwind collateral. Add precision edge-case tests around the UFix64 minimum unit of 0.00000001, using the numerical example as a guide. Done means closeYieldVault either leaves zero or explicitly allowed dust, or reverts without burning the strategy.
索引モデルが issue の本文から書いたものです。
説明
Summary
closeYieldVault can succeed while leaving a tiny non-zero FCM position (small residual debt/collateral).
Root cause: close flow relies on UFix64 (8 decimals) plus swap quote rounding, so exact repay amounts are not always representable in one pass.
This is separate from #152.
Why this matters
- A user expects "close" to mean fully closed.
- Current behavior can leave a small residual position after close.
- Residual is usually tiny, but this breaks close invariants and creates inconsistent behavior.
Expected behavior
On close, protocol should either:
- Fully unwind debt/collateral to zero (or a defined dust threshold), then burn; or
- Revert and keep vault open if full unwind cannot be guaranteed.
Acceptance criteria
- After
closeYieldVault, residual debt/collateral is zero (or <= explicit dust threshold). - No successful close that burns strategy while leaving non-zero position above threshold.
- Precision edge-case tests added around UFix64 minimum unit (
0.00000001).
Numerical example (what is happening)
Observed close flow (mainnet investigation):
-
Before close:
- Collateral:
0.00001000 WETH - Debt:
0.02038486 MOET getYieldVaultBalance():0.00000996 WETH(less than full collateral)
- Collateral:
-
During close:
0.01911391 tauUSDFvswapped to0.02030333 MOETfor repayment
-
After close:
- Residual debt:
0.00008153 MOET - Residual collateral:
0.00000004 WETH
- Residual debt:
Precision constraint:
- Price used:
3312.54037990 MOET/WETH - Exact collateral needed for residual debt:
~0.00000002461253 WETH - UFix64 step is
0.00000001, so exact amount is not representable0.00000002underpays0.00000003clears debt (with small overpayment)
- 主要言語
- Cadence
- スター
- 41
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
onflow/FlowYieldVaults のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
onflow/FlowYieldVaults#274 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
onflow/FlowYieldVaults#273 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
onflow/FlowYieldVaults#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
onflow/FlowYieldVaults#271 ·
-
Move all test files into `./cadence/tests`再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
onflow/FlowYieldVaults#270 ·
onflow/FlowYieldVaults の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
paradigmxyz/reth#28086 ·
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
btclib-org/btclib-node#2035 ·
メンテナーはふだん 1 日以内に返信
-
bug core difficulty: medium priority: high reliability sdk Stellar Wave
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
trustflow-protocol/trustflow-sdk#599 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
D-easy P-low T-task
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100