Skip to content

feat(contract): DAO force-cancel, bridge escape hatch, jump-rate curve, and rotation expiry cleanup - #887

Merged
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
cokehill:main
Jul 29, 2026
Merged

feat(contract): DAO force-cancel, bridge escape hatch, jump-rate curve, and rotation expiry cleanup#887
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
cokehill:main

Conversation

@cokehill

Copy link
Copy Markdown
Contributor

Summary

This PR bundles four related contract hardening/feature items scoped for the current Stellar Wave cycle:

  1. DAO force-cancel for toxic listings — governance-gated force_cancel_listing(listing_id) so the DAO can scrub spam/malicious marketplace listings without relying on the original lister.
  2. Timelocked escape hatch for stranded bridge assets — adds a 7-day challenge window plus admin-signed clawback path so funds aren't permanently stuck if the destination chain halts.
  3. Dynamic jump-rate curve for the lending pool — replaces the flat utilisation / 50 linear model with a configurable kink curve (kink at 80% utilisation, 2x slope above kink), matching standard lending-market rate design.
  4. Admin key rotation expiry cleanup — fixes state hygiene around rejected/expired pending rotation requests so they're pruned and audit-logged instead of lingering.

Changes

  • Added force_cancel_listing governance entrypoint with DAO-only auth check.
  • Added bridge escape module: 7-day challenge window, admin-signed clawback signature verification.
  • Replaced linear interest rate model with piecewise jump-rate curve; curve params configurable per pool.
  • Added expiry handling in rotation confirm/reject path; expired pending rotations are pruned and emit an audit event.
  • Test coverage: happy path + non-DAO caller rejection (force-cancel), scenario tests + Kani harness (bridge escape), property tests around the kink + SDK helpers (jump-rate), cargo test expiry case + Kani harness (rotation expiry).
  • SDK helpers and docs updated where applicable (jump-rate formula, bridge escape flow).

Why

Operational response and safety/UX gaps identified across governance, bridging, lending, and admin key management — bundled here since they touch overlapping contract state and test infrastructure.

Testing

  • cargo test (including new expiry and force-cancel cases)
  • Kani proof harness (bridge escape, rotation expiry)
  • Property tests around the rate curve kink

Closes #824
Closes #820
Closes #825
Closes #821

…mp-rate curve, and rotation expiry cleanup


- Add governance-gated force_cancel_listing(listing_id) so the DAO
  can remove spam/malicious marketplace listings (tests: happy path
  + non-DAO caller rejection)
- Add timelocked escape hatch for stranded bridge assets: 7-day
  challenge window + admin-signed clawback (tests: scenarios, Kani
  harness, SDK + docs)
- Replace linear (utilisation / 50) interest model with configurable
  jump-rate curve (kink at 80% utilisation, 2x slope above kink)
  (tests: property tests around kink, SDK helpers, docs)
- Fix pending admin key rotation expiry handling: expired requests
  are now pruned and audit-logged instead of left stale (tests:
  cargo test expiry case, Kani harness, doc note)

Closes MettaChain#824, MettaChain#820, MettaChain#825, MettaChain#821

@nanaf6203-bit nanaf6203-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nanaf6203-bit
nanaf6203-bit merged commit 9df4db9 into MettaChain:main Jul 29, 2026
2 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