Skip to content

feat: Stellar Wave – Issues #252, #253, #254, #258#265

Merged
elizabetheonoja-art merged 2 commits into
Utility-Drip:mainfrom
DanielCharis1:feat/issues-252-253-254-258-stellar-wave
Apr 28, 2026
Merged

feat: Stellar Wave – Issues #252, #253, #254, #258#265
elizabetheonoja-art merged 2 commits into
Utility-Drip:mainfrom
DanielCharis1:feat/issues-252-253-254-258-stellar-wave

Conversation

@DanielCharis1
Copy link
Copy Markdown
Contributor

Summary

Implements all four Stellar Wave issues assigned to @DanielCharis1.


Issue #258 – Auto-Rent-Deduction for Protocol Storage

  • Adds a rent-deduction hook inside claim() that automatically deducts 1 000 stroops (0.0001 XLM) from the meter balance to extend the contract's ledger TTL.
  • Only triggers when the current TTL falls below a 6-month safety threshold (~3 110 400 ledgers).
  • Skips silently for non-XLM tokens to avoid blocking the stream.
  • Emits a RentRenew event with the deduction amount and new TTL.
  • Closes Implement "Auto-Renew" for Protocol Storage Rent #258

Issue #254 – Formal Proof: Per-Second Stream Exhaustion Invariant

  • Adds calculate_remaining_balance() pure helper with floor-division rounding (always in favour of contract solvency).
  • Adds 4 fuzz tests in fuzz_tests.rs:
    • test_stream_exhaustion_invariant_randomised – 100 000 randomised (balance, rate) pairs via deterministic LCG
    • test_stream_never_negative_after_pause_resume – 10-year simulation with pause/resume and partial top-ups
    • test_rounding_always_favours_solvency – verifies floor-division rounding direction
    • test_calculate_remaining_balance_never_negative – exhaustive grid search
  • Creates SECURITY.md with a mathematical proof of the invariant and auditor documentation.
  • Closes Formal Proof: Per-Second Stream Exhaustion Invariant #254

Issue #253 – Multi-Sig Technical Veto for IoT Fleet

  • Adds FleetSecurityCouncil (up to 5 members, 3-of-5 threshold) and StagedFleetUpdate structs.
  • New functions: register_fleet_council, stage_fleet_update, veto_fleet_update, execute_fleet_update, request_dao_council_rotation, finalize_dao_council_rotation.
  • All fleet-level config changes go through a 48-hour staging window; the council can veto within the window.
  • Emergency circuit-breaker updates bypass the staging window.
  • Lost council keys can be rotated by the DAO after a 7-day delay.
  • Emits FleetUpdateStaged, FleetUpdateVetoed, FleetUpdateExec events.
  • Closes Implement Multi-Sig "Technical Veto" for IoT Fleet #253

Issue #252 – Built-In Dynamic Carbon-Credit Streaming

  • Adds CarbonCreditState struct and CarbonCreditMinter cross-contract client interface.
  • Hook in claim() accumulates credit slices: tokens_streamed × green_ratio × multiplier.
  • Full integer credits trigger a cross-contract mint; failures are stored in a Deferred_Issuance buffer.
  • New functions: set_green_energy_ratio, set_carbon_minter, retry_deferred_carbon_credits, get_carbon_credit_state.
  • Emits CarbonCreditsAccrued and CCDeferred events.
  • Closes Built-In Dynamic "Carbon-Credit" Streaming #252

Bug Fixes (pre-existing)

  • Removed duplicate use imports at top of lib.rs
  • Added missing is_closed field to Meter struct
  • Added missing green_energy_discount_bps and renewable_* fields in batch_register_meters
  • Fixed broken refresh_activity(meter) call (missing now parameter)
  • Removed duplicate get_provider_total_pool and get_watt_hours_display function definitions
  • Fixed verify_usage_signature ? operator used in non-Result function
  • Fixed get_effective_rate called with wrong arity in deduct_units

Testing

…ip#254, Utility-Drip#258 (Stellar Wave)

Issue Utility-Drip#258 - Auto-Rent-Deduction:
- Add RENT_DEDUCTION_STROOPS (1000 stroops) and TTL safety threshold constants
- Hook in claim() to auto-deduct rent when TTL < 6-month threshold
- Emit RentRenew event with deduction amount and new TTL
- Skip silently for non-XLM tokens to avoid blocking streams

Issue Utility-Drip#254 - Formal Proof: Per-Second Stream Exhaustion Invariant:
- Add calculate_remaining_balance() pure helper with floor-division rounding
- Add 4 fuzz tests: 100k randomised inputs, 10-year pause/resume simulation,
  rounding direction verification, exhaustive grid search
- Create SECURITY.md with mathematical proof and auditor documentation

Issue Utility-Drip#253 - Multi-Sig Technical Veto for IoT Fleet:
- Add FleetSecurityCouncil struct (up to 5 members, 3-of-5 threshold)
- Add StagedFleetUpdate struct with 48-hour staging window
- Add register_fleet_council, stage_fleet_update, veto_fleet_update,
  execute_fleet_update, request_dao_council_rotation,
  finalize_dao_council_rotation, get_staged_update, get_fleet_council
- Emergency bypass for circuit-breaker updates
- 7-day DAO rotation delay for lost council keys

Issue Utility-Drip#252 - Carbon-Credit Streaming:
- Add CarbonCreditState struct with accumulated_slices, deferred_credits
- Add CarbonCreditMinter cross-contract client interface
- Hook in claim() to accumulate credit slices per green energy ratio
- Cross-contract mint on full integer credit; defer on failure
- Add set_green_energy_ratio, set_carbon_minter, retry_deferred_carbon_credits,
  get_carbon_credit_state functions

Bug fixes:
- Remove duplicate imports at top of lib.rs
- Add missing is_closed field to Meter struct
- Add missing green_energy_discount_bps and renewable fields in batch_register
- Fix broken refresh_activity(meter) call (missing now parameter)
- Fix duplicate get_provider_total_pool and get_watt_hours_display functions
- Fix verify_usage_signature ? operator in non-Result function
- Fix get_effective_rate called with wrong arity
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 27, 2026

@DanielCharis1 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! 🚀

Learn more about application limits

@elizabetheonoja-art elizabetheonoja-art merged commit ab3c4e2 into Utility-Drip:main Apr 28, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants