Skip to content

feat: opt-in backstop pool for slashed-intent user compensation - #334

Open
Keengfk wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Keengfk:feat/backstop-pool
Open

feat: opt-in backstop pool for slashed-intent user compensation#334
Keengfk wants to merge 1 commit into
stellar-vortex-protocol:mainfrom
Keengfk:feat/backstop-pool

Conversation

@Keengfk

@Keengfk Keengfk commented Aug 31, 2026

Copy link
Copy Markdown
  • Add DataKey::BackstopPool (instance) and BackstopClaimed(BytesN<32>) (persistent) storage keys
  • Add Error::BackstopPoolEmpty=35 and BackstopAlreadyClaimed=36
  • Add MAX_BACKSTOP_BPS (5 000) and MAX_BACKSTOP_CLAIM_BPS (100) constants
  • Add missing constants: DEFAULT_MIN_BOND, DEFAULT_FILL_WINDOW, DEFAULT_INTENT_EXPIRY, DEFAULT_PROTOCOL_FEE_BPS, MAX_PROTOCOL_FEE_BPS, MIN_FILL_WINDOW_SECS, MIN_INTENT_EXPIRY_SECS, MIN_BOND_FLOOR, SLASH_COOLDOWN, CANCEL_COOLDOWN, MAX_BATCH_SIZE, MAX_EXTENSION_DURATION
  • Add missing DataKey variants: Config, PendingAdmin, AllowedDstTokenList, PendingDstTokenAdd, PendingDstTokenRemove, MinBondMultiplier, UserIntents, CancelCooldown, ExtensionGranted
  • Fix Error enum duplicate discriminants; add TimelockNotElapsed=26, NoPendingAdminTransfer=27, NoPendingDstTokenChange=28, InvalidSrcToken=29, AmountTooLarge=30, InvalidConfig=31, CancelCooldownNotExpired=32, SrcChainNotAllowed=33, RescueProtectedToken=34
  • Add backstop_bps: i128 field to ProtocolConfig (default 0 = dormant)
  • Update set_config to accept and validate backstop_bps (0..=MAX_BACKSTOP_BPS)
  • Modify slash_solver: divert backstop_bps share into BackstopPool before transferring remainder to fee_recipient (CEI discipline preserved); event payload extended to (intent_id, slash_amount, backstop_amount)
  • Add claim_backstop_compensation entrypoint: user calls once per intent, payout capped at MAX_BACKSTOP_CLAIM_BPS (1%) of pool, min 1 stroop; BackstopClaimed flag prevents double-claims across re-slash cycles
  • Add get_backstop_pool view function
  • Add get_pending_admin view function (was missing)
  • Fix fill_intent: remove duplicate premature token transfers (triple-send bug)
  • Fix existing tests: pass &caller to pause() (was zero-arg in 3 tests)
  • Add backstop pool test suite: accumulation, successful claim, double-claim rejection, empty pool / bps=0 rejection, config validation tests

Summary

Related issue

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • CI / tooling

Component

  • Contract (vortex-contract)
  • Backend (vortex-backend)
  • Frontend (vortex-frontend)

Checklist

  • My code follows the project's style and conventions
  • I ran lint / type-check / build locally and they pass
  • I added or updated tests where appropriate
  • I updated documentation where appropriate
  • My commits follow Conventional Commits

Screenshots / notes

closes #280

- Add DataKey::BackstopPool (instance) and BackstopClaimed(BytesN<32>)
  (persistent) storage keys
- Add Error::BackstopPoolEmpty=35 and BackstopAlreadyClaimed=36
- Add MAX_BACKSTOP_BPS (5 000) and MAX_BACKSTOP_CLAIM_BPS (100) constants
- Add missing constants: DEFAULT_MIN_BOND, DEFAULT_FILL_WINDOW,
  DEFAULT_INTENT_EXPIRY, DEFAULT_PROTOCOL_FEE_BPS, MAX_PROTOCOL_FEE_BPS,
  MIN_FILL_WINDOW_SECS, MIN_INTENT_EXPIRY_SECS, MIN_BOND_FLOOR,
  SLASH_COOLDOWN, CANCEL_COOLDOWN, MAX_BATCH_SIZE, MAX_EXTENSION_DURATION
- Add missing DataKey variants: Config, PendingAdmin, AllowedDstTokenList,
  PendingDstTokenAdd, PendingDstTokenRemove, MinBondMultiplier, UserIntents,
  CancelCooldown, ExtensionGranted
- Fix Error enum duplicate discriminants; add TimelockNotElapsed=26,
  NoPendingAdminTransfer=27, NoPendingDstTokenChange=28, InvalidSrcToken=29,
  AmountTooLarge=30, InvalidConfig=31, CancelCooldownNotExpired=32,
  SrcChainNotAllowed=33, RescueProtectedToken=34
- Add backstop_bps: i128 field to ProtocolConfig (default 0 = dormant)
- Update set_config to accept and validate backstop_bps (0..=MAX_BACKSTOP_BPS)
- Modify slash_solver: divert backstop_bps share into BackstopPool before
  transferring remainder to fee_recipient (CEI discipline preserved);
  event payload extended to (intent_id, slash_amount, backstop_amount)
- Add claim_backstop_compensation entrypoint: user calls once per intent,
  payout capped at MAX_BACKSTOP_CLAIM_BPS (1%) of pool, min 1 stroop;
  BackstopClaimed flag prevents double-claims across re-slash cycles
- Add get_backstop_pool view function
- Add get_pending_admin view function (was missing)
- Fix fill_intent: remove duplicate premature token transfers (triple-send bug)
- Fix existing tests: pass &caller to pause() (was zero-arg in 3 tests)
- Add backstop pool test suite: accumulation, successful claim, double-claim
  rejection, empty pool / bps=0 rejection, config validation tests
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Keengfk 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[High] Implement a solver-default user-backstop pool funded from slash proceeds

1 participant