feat: resolve issues #195, #197, #203, #205 (Xhristin3)#243
Merged
elizabetheonoja-art merged 2 commits intoApr 26, 2026
Merged
Conversation
…#203, Utility-Drip#205 (Xhristin3) Issue Utility-Drip#195 - Minimum Yield-Routing Gas Thresholds: - Add DEFAULT_MIN_ROUTE_THRESHOLD constant (10_000_000 stroops / 1 XLM) - Add DataKey::MinRouteThreshold for DAO-updatable governance - Add set_min_route_threshold(), get_min_route_threshold(), route_to_yield() - route_to_yield() panics with BelowMinRouteThreshold if amount < threshold Issue Utility-Drip#197 - Treasury Streaming-Fee Collector: - Add DataKey::PlatformFeeBps, ProtocolFeeVault, StreamingFeeAccrued(u64) - Add MAX_PLATFORM_FEE_BPS constant (1000 bps = 10%) - Deduct platform fee from gross flow accumulation in update_continuous_flow() - Fee = floor(accumulation * bps / 10000) — truncation never favors attacker - Add set_platform_fee_bps(), set_protocol_fee_vault(), collect_streaming_fees() - Add get_platform_fee_bps(), get_accrued_streaming_fees() Issue Utility-Drip#203 - Formal Verification of Streaming Invariant: - Add streaming_invariant_tests.rs proving Total_Deposited == Total_Streamed + Total_Remaining + Fees - Tests cover: zero-fee, with-fee, edge cases, 1M-tick simulation, contract-level Issue Utility-Drip#205 - Fuzz Test: 1-Stroop Micro-Deductions: - Add stroop_fuzz_tests.rs with AC-1/AC-2/AC-3 acceptance criteria - Proves truncation never favors attacker, fractional remains go to dust sweeper - High-frequency 10k-tick simulation with 1-stroop/sec rate Also fix pre-existing structural bugs in lib.rs: - disable_privacy_mode missing closing brace - Broken duplicate create_continuous_stream / withdraw_continuous bodies - Duplicate get_meter_or_panic, pause_stream, resume_stream definitions - Broken allocate_to_maintenance_fund body - Incomplete apply_provider_withdrawal_limit stub - Duplicate UsageReport / SignedUsageData struct definitions Closes Utility-Drip#195, Utility-Drip#197, Utility-Drip#203, Utility-Drip#205
|
@Xhristin3 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves all 4 issues assigned to @Xhristin3 in a single PR.
Issue #195 — Create Minimum Yield-Routing Gas Thresholds
DEFAULT_MIN_ROUTE_THRESHOLDconstant (10,000,000 stroops = 1 XLM)DataKey::MinRouteThresholdfor DAO governance updatesset_min_route_threshold(),get_min_route_threshold(),route_to_yield()route_to_yield()panics withBelowMinRouteThresholdif capital is below threshold, protecting the protocol from gas-negative micro-depositsIssue #197 — Develop Treasury "Streaming-Fee" Collector
DataKey::PlatformFeeBps,ProtocolFeeVault,StreamingFeeAccrued(u64)MAX_PLATFORM_FEE_BPSconstant (1000 bps = 10% ceiling)update_continuous_flow():fee = floor(gross * bps / 10000)— truncation never favors the attackerset_platform_fee_bps(),set_protocol_fee_vault(),collect_streaming_fees()Issue #203 — Formal Verification of Streaming Invariant
New file:
src/streaming_invariant_tests.rsProves Total_Deposited == Total_Streamed + Total_Remaining + Fees across:
Issue #205 — Fuzz Test: 1-Stroop Micro-Deductions
New file:
src/stroop_fuzz_tests.rsCovers all 3 acceptance criteria:
fee + net == grossfor all inputsis_dust_amountandupdate_dust_aggregationPre-existing bugs also fixed
The lib.rs had several structural issues that prevented compilation:
disable_privacy_modemissing closing bracecreate_continuous_stream/withdraw_continuousfunction bodiesget_meter_or_panic,pause_stream,resume_streamdefinitionsallocate_to_maintenance_fundbodyapply_provider_withdrawal_limitstubUsageReport/SignedUsageDatastruct definitionsCloses #195
Closes #197
Closes #203
Closes #205